function attributes are like function objects

Dieter Maurer dieter at handshake.de
Fri Feb 2 21:48:22 CET 2001


"Fredrik Lundh" <fredrik at effbot.org> writes on Thu, 01 Feb 2001 17:22:45 GMT:
> (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...)
Zope makes quite good use of function attributes:

  It uses them to associate permissions, for example.

  It is better to have them directly attached to the
  function rather than maintained in a separate object, such
  as a dictionary. For, if the function is passed around
  the program, its attributes are automatically passed
  with it. Otherwise, the auxiliary object would need
  to be passed explicitly.


Dieter



More information about the Python-list mailing list