book_cover

This book gives a quick intro to Python and does not need any prior programming knowledge to get going. I quick read this in an hour’s time. Some of the points that I found interesting in the book are

  • help(str) gives all the functions associated with str
  • There is no char datatype in Python
  • Statements which go together must have the same indentation
  • Use the built-in dir function to list the identifiers that a module defines
  • Singleton tuple can be created by specifying it this way  (a,)
  • Assignment for lists does not create copy. You have to use slicing operation to make a copy
  • os.system(ANY WINDOWS COMMAND) will execute the command
  • time.strftime(‘format string’) gives the current time
  • There are class variables and instance variables, very much different from the other languages
  • All class members are public and all the methods are virtual in Python
  • Python does not automatically call the constructor of the  base class, you have to explicitly call it yourself
  • For Double underscore variables, Python effectively makes it a private variable
  • Python provides a standard module called pickle using which you can store any Python object in a file and then get it back later intact
  • One can dump and retrieve objects in to a file that has an extension .data using pickle and cpickle module
  • lambda statement is used to create new function objects and then return them at run time
  • repr is used to get string representation of the object
  • exec is used to execute Python statements which are stored in a string. eval is used to evaluate valid Python expressions
  • assert is used to assert that something is true
  • You can use tuples or lists in functions using * or **
  • Some of the GUI libraries in Python are PyQT, PyGTK, wxPython,TkInter
  • Need to check out Charming Python link mentioned in the book