function attributes are like function objects

Fredrik Lundh fredrik at
Thu Feb 1 18:22:45 CET 2001

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...)

Cheers /F

More information about the Python-list mailing list