python

What's new in Python

Incomplete list of new features and changes in Python releases.

2.6

  • with statement
  • string formatting with .format()
  • print as a function with from future import print_function
  • try: ... except TypeError as exc: ... syntax
  • abstract base classes
  • class decorators
  • 3 attributes for properties: @property, @x.setter, @x.deleter

2.7

  • syntax for set literals ({1, 2, 3} is a mutable set)
  • dictionary and set comprehensions
  • OrderedDictionary
  • argparse module