Invisible function attributes
Bob Gailer
bgailer at alum.rpi.edu
Wed Sep 3 13:25:41 EDT 2003
Of course the inevitable question is why do you want to do this? Consider
creating a class instead (with a __call__ method if you want to call the
instance as a function).
class Foo:
a = 1 # pre-initialized property
def __call__(self):
print self.a
foo = Foo()
foo()
# prints 1
Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003
More information about the Python-list
mailing list