Help me understand this
Beej
beej at beej.us
Tue Jan 30 04:34:01 EST 2007
On Jan 29, 11:47 pm, Steven D'Aprano
<s... at REMOVEME.cybersource.com.au> 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
-Beej
More information about the Python-list
mailing list