mirror of https://github.com/python/cpython.git
Add various and sundry news items -- most mine, one Barry's, one
Michael Hudson's.
This commit is contained in:
parent
97741a3041
commit
ae45714ed3
44
Misc/NEWS
44
Misc/NEWS
|
@ -3,6 +3,43 @@ What's New in Python 2.2a3?
|
|||
|
||||
Core
|
||||
|
||||
+ Overflowing operations on plain ints now return a long int rather
|
||||
than raising OverflowError. This is a partial implementation of PEP
|
||||
237. You can use -Wdefault::OverflowWarning to enable a warning for
|
||||
this situation, and -Werror::OverflowWarning to revert to the old
|
||||
OverflowError exception.
|
||||
|
||||
+ A new command line option, -D<arg>, is added to control run-time
|
||||
warnings for the use of classic division. (See PEP 238.) Possible
|
||||
values are -Dold, -Dwarn, and -Dnew. The default is -Dold, meaning
|
||||
the / operator has its classic meaning and no warnings are issued.
|
||||
Using -Dwarn issues a run-time warning about all uses of classic
|
||||
division for int, long, float and complex arguments. Using -Dnew is
|
||||
questionable; it turns on new division by default, but only in the
|
||||
__main__ module. You can usefully combine -Dwarn and -Dnew: this
|
||||
gives the __main__ module new division, and warns about classic
|
||||
division everywhere else.
|
||||
|
||||
+ Many built-in types can now be subclassed. This applies to int,
|
||||
long, float, str, unicode, and tuple. (The types complex, list and
|
||||
dictionary can also be subclassed; this was introduced earlier.)
|
||||
Note that restrictions apply when subclassing immutable built-in
|
||||
types: you can only affect the value of the instance by overloading
|
||||
__new__. You can add mutable attributes, and the subclass instances
|
||||
will have a __dict__ attribute, but you cannot change the "value"
|
||||
(as implemented by the base class) of an immutable subclass instance
|
||||
once it is created.
|
||||
|
||||
+ A new built-in type, super, has been added. This facilitates making
|
||||
"cooperative super calls" in a multiple inheritance setting. For an
|
||||
explanation, see http://www.python.org/2.2/descrintro.html#cooperation
|
||||
|
||||
+ A new built-in type, getset, has been added. This enables the
|
||||
creation of "computed attributes". Such attributes are implemented
|
||||
by getter and setter functions (or only one of these for read-only
|
||||
or write-only attributes), without the need to override
|
||||
__getattr__. See http://www.python.org/2.2/descrintro.html#getset
|
||||
|
||||
+ The syntax of floating-point and imaginary literals has been
|
||||
liberalized, to allow leading zeroes. Examples of literals now
|
||||
legal that were SyntaxErrors before:
|
||||
|
@ -22,6 +59,9 @@ Library
|
|||
When read on a box where Python ints are 4 bytes, such values are
|
||||
converted to Python longs.
|
||||
|
||||
+ In restricted execution mode (using the rexec module), unmarshalling
|
||||
code objects is no longer allowed. This plugs a security hole.
|
||||
|
||||
Tools
|
||||
|
||||
Build
|
||||
|
@ -44,6 +84,10 @@ API
|
|||
|
||||
- remove calls to PyObject_AS_GC and PyObject_FROM_GC
|
||||
|
||||
+ Two new functions: PyString_FromFormat() and PyString_FromFormatV().
|
||||
These can be used safely to construct string objects from a
|
||||
sprintf-style format string (similar to the format string supported
|
||||
by PyErr_Format()).
|
||||
|
||||
New platforms
|
||||
|
||||
|
|
Loading…
Reference in New Issue