Linux/Unix > Python Essential Reference, Second Edition > C. Summary of Changes > Python 2.0 | See All Titles

< BACK | Make Note | Bookmark | CONTINUE >

155117184014003188065099048180054212144238241179195140058238111161104059122182070167086172

### Python 2.0

- Unicode support.

- List comprehensions.

- Augmented assignment operators (`+=`, `-=`, `*=`, `/=`, `%=`, `**=`, `&=`, `|=`, `^=`, `>>=`, and `<<=`) and associated special methods `_ _iadd_ _`, `_ _isub_ _`, etc.

- The syntax `f` `(*``args` `,**``kwargs` `)` can now be used to call a function with positional arguments `args` and keyword arguments `kwargs` . Previously, the built-in `apply()` function was used for this purpose.

- Garbage collection of cyclical data structures and the `gc` module.

- Enhanced `print` statement. `print >>``f` `,` `obj` now redirects its output to the file object `f` .

- The `import` statement has been enhanced with the `as` modifier; for example, `import foo as bar`. However, `as` is not a new Python reserved word.

- String methods added to both standard and Unicode strings. These methods replace most of the functionality in the `string` module.

- `d` `.setdefault()` method added to dictionaries.

- New built-in functions: `zip()`, `unichr()`, `unicode()`.

- New modules described in Appendix A, “The Python Library”: `gc`, `UserString`, `_winreg`, `zipfile`, `unicodedata`, `encodings`, `codecs`, `atexit`, `filecmp`, `gettext`, `mmap`, `robotparser`, `webbrowser`.

- New exceptions: `UnboundLocalError`, `UnicodeError`.

| Last updated on 3/28/2002 Python Essential Reference, Second Edition, © 2002 New Riders Publishing

< BACK | Make Note | Bookmark | CONTINUE >

© 2002, O'Reilly & Associates, Inc.