function attributes are like function objects

Robert L Hicks bobhicks at adelphia.net
Thu Feb 1 13:27:14 EST 2001


> From: "Fredrik Lundh" <fredrik at effbot.org>
> Organization: Telia Internet
> Newsgroups: comp.lang.python
> Date: Thu, 01 Feb 2001 17:22:45 GMT
> Subject: Re: function attributes are like function objects
> 
> Michael Hudson wrote:
>>> What's so special about functions that we need to
>>> be able to plonk arbitrary attributes on them, but
>>> not any other builtin types?
>> 
>> The fact that people were using the one attribute they could get at
>> (__doc__) for things far from its original purpose?
> 
> well, if people are too lazy to write
> 
> def f(...):
> ...
> a[f] = "something"
> 
> do you really think they'll find it much easier to write:
> 
> def f(...):
> ...
> f.a = "something"
> 
> (fwiw, I think function attributes is about the dumbest
> thing we've added to python lately -- face it, "because
> we can" isn't a very good argument when deciding what
> to add to the language core...)

Was that the rational? Let's add it because we can? 




More information about the Python-list mailing list