Beej wrote:

> On Jan 29, 11:47 pm, Steven D'Aprano
> <[EMAIL PROTECTED]> wrote:
>> Outside of a print statement (and also an "except" statement), commas
>> create tuples.
> 
> And function calls:
> 
>>>> 3,
> (3,)
>>>> type(3,)
> <type 'int'>
>>>> type((3,))
> <type 'tuple'>
> 
> But here's one I still don't get:
> 
>>>> type(2)
> <type 'int'>
>>>> type((2))
> <type 'int'>
>>>> (2).__add__(1)
> 3
>>>> 2.__add__(1)
>   File "<stdin>", line 1
>     2.__add__(1)
>             ^
> SyntaxError: invalid syntax

Because 2. is the start of a float-literal. That isn't distinguishable for
the parsere otherwise.


Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to