Hi! I had the same problem myself. Mark's detailed explanation really helped me understand.
I ended up doing something like:
class A:
def __init__(self):
names = 'n1', 'n2'
for n in names:
setattr(self, "get%s" % n, self._createGetter(n))
def _createGetter(self, n):
def f(): return n
return f
Thanks a lot
Cheers,
Tiago
--
http://mail.python.org/mailman/listinfo/python-list
