- New built-in function list() converts any sequence to a new list.
Note that when the argument is a list, the return value is a fresh
copy, similar to what would be returned by a[:].
- Improved syntax error message. Syntax errors detected by the code
generation phase of the Python bytecode compiler now include a line
number. The line number is appended in parentheses. It is suppressed
if the error occurs in line 1 (this usually happens in interactive
use).
- Different exception raised.
Unrecognized keyword arguments now raise a TypeError exception
rather than KeyError.
- Exceptions in __del__ methods. When a __del__ method
raises an exception, a warning is written to sys.stderr and the
exception is ignored. Formerly, such exceptions were ignored without
warning. (Propagating the exception is not an option since it it is
invoked from an object finalizer, which cannot return any kind of
status or error.) (Buglet: The new behavior, while needed in order to
debug failing __del__ methods, is occasionally annoying,
because if affects the program's standard error stream. It honors
assignments to sys.stderr, so it can be redirected from within
a program if desired.)
- You can now discover from which file (if any) a module was loaded by
inspecting its __file__ attribute. This attribute is not
present for built-in or frozen modules. It points to the shared
library file for dynamically loaded modules. (Buglet: this may be a
relative path and is stored in the .pyc file on compilation.
If you manipulate the current directory with os.chdir() or move
.pyc files around, the value may be incorrect.)