Python is constantly changing in little ways. Python 3.1 has evolved from version 2.6, but it contains important changes. This appendix introduces you to the changes relevant to the topics covered in this book. This means that this is not an exhaustive treatment by any means but only a selection of topics touched on in the book — topics that you may want to know as someone new to Python.
You can find the official list of changes to Python 3.1 at
http://docs.python.org/3.1/whatsnew/3.1.html. If a newer version of Python is available by the time you read this, you can find the list of changes for that version on the Python website as well.
In the olden days of yore, print was a statement. With version 3.1, it has reached the major leagues and is now a bonafide function — specifically,
The following no longer return lists, but instead return views and iterators:
The dict methods —
dict.values. You will also note that
dict.itervalues() are no longer supported methods in Python.
filter() return iterators instead of lists.
range() method has replaced
xrange() and is used in the same manner.
zip() method is now used to return an iterator.
The long data type has been renamed to int (basically the only integral type is now int). It works in roughly the same manner as the long type did. Integers ...