Nadeem Vawda <nadeem.va...@gmail.com> added the comment: The behaviour of int() can be made consistent with the syntax for Python integer literals by specifying a base of 0:
>>> int("0050", 0) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 0: '0050' >>> int("0o050", 0) 40 >>> int("0x050", 0) 80 >>> int("0b010", 0) 2 As for changing the default behaviour, I think it would be a bad idea. Having ``0050'' be an invalid token is perhaps jarring to people used to C/C++/Java/etc., but at least attempts to use it fail loudly and obviously. Having it be valid and yet mean something different could lead to nasty surprises for the unsuspecting. ---------- nosy: +nadeem.vawda _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12127> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com