scope of function parameters

Laurent moky.math at gmail.com
Mon May 30 03:38:05 EDT 2011


>>  Could you give an example of an object that has no name ? I've missed
>>  something ...
>
> def foo():
>      return 5
>
> print(foo())
>
> The int object 5 has no name here.

Cool. I was thinking that "5" was the name, but
 >>> 5.__add__(6)
   File "<stdin>", line 1
     5.__add__(6)
             ^
SyntaxError: invalid syntax

while

 >>> a=5
 >>> a.__add__(6)
11


Very well. I learned something today.
Thanks
Laurent



More information about the Python-list mailing list