On Friday, March 25, 2011 6:53:48 AM UTC-4, Andrea Crotti wrote: > > I had never seen such a thing, but why would this make sense at all? > When does it make sense logically for a function to have an attribute? > > A function should have some input, some local variables to compute > temporary results and a return value, I think nothing more...
See Pep 232: http://www.python.org/dev/peps/pep-0232 Also, see the discussion thread on Python-Dev: http://mail.python.org/pipermail/python-dev/2000-April/thread.html#3282 I don't think self-referenced static variables (as in C's "static" declaration) are discussed as a use case. Nonetheless, I've seen it done. For example: http://stackoverflow.com/questions/338101/python-function-attributes-uses-and-abuses/338420#338420 -- http://mail.python.org/mailman/listinfo/python-list