[Python-ideas] Allow attribute references for decimalinteger

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Oct 31 02:17:12 CET 2013


On Wed, Oct 30, 2013 at 9:01 PM, אלעזר <elazarg at gmail.com> wrote:

> >>> 1.real
>   File "<stdin>", line 1
>     1.real
>          ^
> SyntaxError: invalid syntax
>
> Why does it fail? To my human eyes it seems (almost) completely
> unambiguous. Is it a lexing thing?
>

Yes.  The first . following a digit makes into the same float token.  To
make . its own token the number must be complete by the time the tokenizer
sees it.  I don't think your proposal is implementable without making
parser significantly more complicated.

> The only ambiguity I can see is 1.j  ..

What would 1.e50 mean under your proposal?  Currently we have

>>> 1.e50
1e+50
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131030/2e4a1747/attachment.html>


More information about the Python-ideas mailing list