On 6 February 2014 12:51, Ram Rachum
And you can't imagine a non-programmer complaining that "0123" is either not a number, or the number 83?
You're right. I suggest int would just throw away the leading zeroes. In Python 3.x there's no meaning to them without 0o or 0x or 0b anyway, right?
Once you get to this point, you're writing your own spec for what input you want to allow, and you're probably better off writing your own code that meets that spec. Sanitising the string how you want then calling ast.literal_eval is easy enough. -1 on changing the behaviour of int. -0.5 on adding a new builtin (I see no need for it, but if others do, it won't cause me any issues if it exists...). +1 on adding documentation examples showing how to use ast.literal_eval to write your own specialised evaluators. Paul.