> I don't think so, since Python proudly says that functions are > first-class objects. > CherryPy does a similar thing to mark a method as "exposed". > > But perhaps I'd write the code this way to avoid an unneeded and > risky recursive call: > > def doStuff(some, arguments, may, *be, **required): > try: > doStuff.timesUsed += 1 > except AttributeError: > doStuff.timesUsed = 1 > # ... special case for first call ... > # ...common code...
True, the recursivity is not needed there I guess :) It just feels so ugly to use try/except to enable the variable but I've found it useful at least once. /buffi (buffis.com) -- http://mail.python.org/mailman/listinfo/python-list