function attributes are like function objects
Barry A. Warsaw
barry at digicool.com
Fri Feb 2 17:41:04 EST 2001
>>>>> "GG" == Geoffrey Gerrietts <geoff at homegain.com> writes:
GG> Or are function attributes pretty much accessible only to
GG> those who know the function by name?
Well, if you have the function passed to you, then you don't need to
know what it's called. You just access the attribute.
def publish(func):
try:
if func.publish:
print func()
except AttributeError:
log('Non-conforming function given to publish(): %s' % func)
-Barry
More information about the Python-list
mailing list