Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...hex or octal constants that appear unsigned but are in fact negative, left shifts that can lose bits or change the sign, and certain conversions to hex or octal. Tim Peters rewrote his list.sort() implementation - this one is a "stable sort" (equal inputs appear in the same order in the output) and faster than before. Tim Peters also changed long int multiplication to use the Karatsuba algorithm, based on a patch by Christopher A. Craig. This speeds up multiplication of very long ints....
...hex and a2b_hex that convert between binary data and its hex representation calendar - Many new functions that support features including control over which day of the week is the first day, returning strings instead of printing them. Also new symbolic constants for days of week, e.g. MONDAY, ..., SUNDAY. cgi - FieldStorage objects have a getvalue method that works like a dictionary's get method and returns the value attribute of the object. ConfigParser - The parser object has ne...
...hex() and oct(). Example: >>> "%x" % -0x42L '-42' # in 2.1 'ffffffbe' # in 2.0 and before, on 32-bit machines >>> hex(-0x42L) '-0x42L' # in all versions of Python The behavior of %d formats for negative Python longs remains the same as in 2.0 (although in 1.6 and before, they raised an error if the long didn't fit in a Python int). %u formats don't make sense for Python longs, but are allowed and treated the same as %d in 2.1. In 2.0, a negative long format...
...hex/oct constants with a leading minus sign would come out with the wrong sign. ("Unsigned" hex/oct constants are those with a face value in the range sys.maxint+1 through sys.maxint*2+1, inclusive; these have always been interpreted as negative numbers through sign folding.) E.g. 0xffffffff is -1, and -(0xffffffff) is 1, but -0xffffffff would come out as -4294967295. This was the case in Python 2.2 through 2.2.2 and 2.3a1, and in Python 2.4 it will once again have that value, but acc...
...hex/oct literals and conversions and left shifts. (Thanks to Kalle Svensson for SF patch 849227.) This addresses most of the remaining semantic changes promised by PEP 237, except for repr() of a long, which still shows the trailing 'L'. The PEP appears to promise warnings for operations that changed semantics compared to Python 2.3, but this is not implemented; we've suffered through enough warnings related to hex/oct literals and I think it's best to be silent now. For str and unicode object...
...hex' and a new class method 'float.fromhex' to convert floating-point numbers to and from hexadecimal strings, respectively. Issue #3083: Add alternate (#) formatting for bin, oct, hex output for str.format(). This adds the prefix 0b, 0o, or 0x, respectively. Issue #3280: like chr(), the "%c" format now accepts unicode code points beyond the Basic Multilingual Plane (above 0xffff) on all configurations. On "narrow Unicode" builds, the result is a string of 2 code units, form...
If you didn't find what you need, try your search in the Python language documentation.