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 digits they required, was left up to each implementation. The language simply stated that \x "consumed" all hex digits following, and left the meaning up to each implementation. So, in effect, \x in C is a standard hook to supply platform-defined behavior. Because Python explicitly aims at platform independence, the \x escape in Python (up to and including 1.6) has been treated the same way across all platforms: all except the last two hex digits were silently ignored. So the only actual...
...hex-escapes all non-ASCII characters. PyObject_ASCII() generates the same string as PyObject_Repr() in Python 2. Add a new built-in function, ascii(). This function converts any python object to a string using repr() and then hex-escapes all non-ASCII characters. ascii() generates the same string as repr() in Python 2. Add a '%a' string format operator. '%a' converts any python object to a string using repr() and then hex-escapes all non-ASCII characters. The '%a' format operator generates ...
...hex() and oct(), %u, %x, %X and %o, hex and oct literals in the (inclusive) range [sys.maxint+1, sys.maxint*2+1], and left shifts losing bits. The new semantic for these operations are implemented. Operations that give different results than before will not issue a warning. The trailing L is dropped from repr(), and made illegal on input. (If possible, the long type completely disappears.) The trailing L is also dropped from hex() and oct(). Phase 1 will be implemented in Python 2.2. Phase 2 ...
...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....
...hexadecimal, which is more popular than octal despite the fact that it requires a 60% larger alphabet than decimal, because each symbol contains 4 bits. Some numbers, such as Unix file permission masks, are easily decoded by humans when represented in octal, but difficult to decode in hexadecimal, while other numbers are much easier for humans to handle in hexadecimal. Unfortunately, there are also binary numbers used in computers which are not very well communicated in either hexadecimal or oct...
...hex, character, etc. This proposal has the virtue of being simpler than the alternative proposal but is much less flexible and meets the needs of fewer users right out of the box. It is expected that some other solution will arise for specifying alternative separators. Current Version of the Mini-Language Python 2.6 docs PEP 3101 Advanced String Formatting Research into what Other Languages Do Scanning the web, I've found that thousands separators are usually one of COMMA, DOT, SPACE, APO...
...hex-escapes non-ASCII strings, e.g.) This PEP proposes to change how str(container) works. It is proposed to mimic how repr(container) works except one detail - call str on items instead of repr. This allows a user to choose what results she want to get - from item.__repr__ or item.__str__. Current situation Most container types (tuples, lists, dicts, sets, etc.) do not implement __str__ method, so str(container) calls container.__repr__, and container.__repr__, once called, forgets it is c...
...hex() that takes a string of characters from the set [0-9a-fA-F ] and returns a bytes object (similar to binascii.unhexlify). For example: >>> bytes.fromhex('5c5350ff') b'\\SP\xff' >>> bytes.fromhex('5c 53 50 ff') b'\\SP\xff' The object has a .hex() method that does the reverse conversion (similar to binascii.hexlify): >> bytes([92, 83, 80, 255]).hex() '5c5350ff' The bytes object has some methods similar to list methods, and others similar to str methods. Here is a ...
...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 encoded digest. In addition to the above, the following constraints are placed on the API: All URLs which respond with an HTML5 page MUST end with a / and the repository SHOULD redirect the URLs without a / to add a / to the end. URLs may be either absolute or relative as long as they point to the correct location. There are no constraints on where the files must be hosted relative to the repository. There may be any other HTML elements on the API pages as long as the required anchor ele...
...hex') The proposed syntax is: b'\x7f\x45\x4c\x46\x01\x01\x01\x00' b'\x7fELF\x01\x01\x01\0' In both cases, the advantages of the new syntax are brevity, some small efficiency gain, and the detection of encoding errors at compile time rather than at runtime. The brevity benefit is especially felt when using the string-like methods of bytes objects: lines = bdata.split(bytes('\n', 'ascii')) # existing syntax lines = bdata.split(b'\n') # proposed syntax And when converting code from Python 2...
...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 encoded digest. The repository MAY use true as the attribute's value if a hash is unavailable. Backwards Compatibility If an anchor tag lacks the data-dist-info-metadata attribute, tools are expected to revert to their current behaviour of downloading the distribution to inspect the metadata. Older tools not supporting the new data-dist-info-metadata attribute are expected to ignore the attribute and maintain their current behaviour of downloading the distribution to inspect the metadata. ...
...hex. For generated files such as *.pyc files, this field must contain the string "-", which indicates that the file's checksum should not be verified. REQUIRES section This section is a list of strings giving the services required for this module distribution to run properly. This list includes the distribution name ("python-stdlib") and module names ("rfc822", "htmllib", "email", "email.Charset"). It will be specified by an extra 'requires' argument to the distutils.core.setup() function....
...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 format. Outputs the number in base 16, using lower- case letters for the digits above 9. 'X' - Hex format. Outputs the number in base 16, using upper- case letters for the digits above 9. 'n' - Number. This is the same as 'd', except that it uses the current locale setting to insert the appropriate number separator characters. '' (None) - the same as 'd' The available floating point presentation types are: 'e' - Exponent notation. Prints the number in scientific ...
...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 or oct conversions or left shifts returns a different value for an int than for a long with the same value. The semantics do not change in Python 2.3; that will happen in Python 2.4. Nuke SET_LINENO from all code objects (providing a different way to set debugger breakpoints). This can boost pystone by >5%. https://bugs.python.org/issue587993, now checked in. (Unfortunately the pystone boost didn't happen. What happened?) Write a pymemcompat.h that people can bundle with their exten...
...hex digest of its BLAKE2b-256 hash, which PyPI may prepend to filenames after the files have been uploaded. For this PEP, it is RECOMMENDED that PyPI adopt a simple convention of the form: digest.filename, where filename is the original filename without a copy of the hash, and digest is the hex digest of the hash. When an unclaimed project uploads a new transaction, a project transaction process MUST add all new target files and relevant delegated unclaimed metadata. The project upload process ...