python at mrabarnett.plus.com
Sat May 7 17:32:53 CEST 2011
On 07/05/2011 08:46, Greg Ewing wrote:
> Bruce Leban wrote:
>> I'm opposed to changing int so that int('123_456') ignores the _ as
>> that will change the behavior of existing code and could break apps.
> But int('123_456', 0) should perhaps work? (On the grounds that
> it parses numbers using the same syntax as Python source.)
There's also the argument that if you forbid it then the programmer
may have to write:
in order to let the user include underscores, which would make it too
permissive. If the user entered "_10", the above code would accept it.
More information about the Python-ideas