[Python-Dev] Backporting PEP 3127 to trunk

Eric Smith eric+python-dev at trueblade.com
Fri Feb 22 04:02:30 CET 2008


Raymond Hettinger wrote:
> [Eric Smith]
>> Speaking for myself, these features are generally useful,
>> and are so even without the new integer literal syntax.
> 
> I'm curious how these are useful to you in Py2.6 where
> they are not invertible.  In Py3.0, we can count on
> 
>   x == int(bin(x), 2)
>   x == eval(bin(x))
> 
> I don't see how these could work in Py2.6 without
> changing the parser and changing the int() function.
> 
> Why would you ever want to create a string like
> '0o144' when there is no way to convert the string
> back into a value?  

Because I need to output the values, for debugging and other purposes. 
I have no need to eval something I've bin'd, so I don't need them to be 
invertible.  Same with hex.

I realize I could just write these functions myself in Python, and not 
use the builtins.  But I don't see the drawback of them being in 2.6.

Eric.



More information about the Python-Dev mailing list