scope of function parameters

Terry Reedy tjreedy at udel.edu
Mon May 30 05:02:36 EDT 2011


On 5/30/2011 3:38 AM, Laurent wrote:

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


Try 5 .__add__(6)

Modules, classes, and functions have a .__name__ attribute (I call it 
their 'definition name') used to print a representation. As best I can 
remember, other builtin objects do not.

-- 
Terry Jan Reedy




More information about the Python-list mailing list