function attributes are like function objects

Tim Peters tim.one at home.com
Fri Feb 2 00:02:06 EST 2001


[/F]
> 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"

Believe it or not, I do.  Bets?  Don't forget methods when deciding how easy
the first alternative is, and that decorating methods (not top-level
functions) is the primary cause of docstring abuse.  But I bet people would
find the latter substantially easier even without methods complicating the
first gimmick.

> (fwiw, I think function attributes is about the dumbest
> thing we've added to python lately

I happen to like sre better myself <wink>.

> -- face it, "because we can" isn't a very good argument
> when deciding what to add to the language core...)

Hmm.  I suppose the PEP would be that much stronger had Barry thought to
mention this argument <ahem>:

    http://python.sourceforge.net/peps/pep-0232.html





More information about the Python-list mailing list