New submission from John Parejko:
As described in PEP-3127, the "leading-zeros" formatting for octal was removed
from python 3. This is a good thing(tm), but the recommendation of that PEP to
improve the error message of the raised exception[1] was apparently never
implemented. I just ran into this while with some recently-ported python2 code,
and it took a while to figure out the problem.
Although this is going to be less of a problem with time as people convert to
pure python3, it will be very helpful during the transition period.
>>> 0o007
7
>>> 007
File "<stdin>", line 1
007
^
SyntaxError: invalid token
1: https://www.python.org/dev/peps/pep-3127/#id17
----------
assignee: docs@python
components: 2to3 (2.x to 3.x conversion tool), Documentation, Interpreter Core
messages: 284591
nosy: John Parejko, docs@python
priority: normal
severity: normal
status: open
title: Confusing "invalid token" exception when integers have leading zero
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29146>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com