[Python-Dev] PEP 318: Set attribs with .name = value

Guido van Rossum guido at python.org
Wed Mar 31 00:06:00 EST 2004


> Personally, I'd prefer to see function attributes made possible by allowing 
> references to the name of the function from within the definition of the 
> function.Eg:
> 
>     def func(arg):
>       func.attrib = value

Since this keeps coming up: this gets a -1000 from me (sorry Barry :).

It is currently valid syntax with valid semantics, and strongly
suggest something it isn't: it looks as if the attribute assignment is
done at function call time rather than at function definition time.

That is the kind of language design that becomes a real liability in
the hands of someone who misinterprets it.

Ditto for variants like ".attrib = value" and even "@attrib = value"
(which I proposed under a heading "thinking aloud" meaning I wasn't so
sure of it).

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list