On 11/09/2012 22:46, Victor Stinner wrote:
2012/9/11 Nick Coghlan <ncoghlan@gmail.com>:
This is fine in an external project, but should never be added to the standard library. The barrier to semantic changes that break monkeypatching should be high.
The version 0.3 has a known bug: "len=chr; print(len('A'))" is optimized, whereas it should not. It is now fixed in the new version 0.3.1.
* Call methods of builtin types if the object and arguments are constants. Examples:
- u"h\\xe9ho".encode("utf-8") => b"h\\xc3\\xa9ho" - "python2.7".startswith("python") => True - (32).bit_length() => 6 - float.fromhex("0x1.8p+0") => 1.5
That last one isn't constant, it's a name lookup.
Well, yes, but in CPython, it is not possible to modify float.fromhex attribute, nor unicode.encode.
It's possible to shadow 'float':
float = "foo" float 'foo'