scoping problems

Narayan Desai desai at mcs.anl.gov
Fri Jul 27 22:14:29 CEST 2001


>>>>> "Rich" == Rich Harkins <rharkins at thinkronize.com> writes:

Rich> Try this: class baseclass():
Rich>       def __init__(self):
Rich>           self.__myfunc__()

Rich> class a(baseclass):
Rich> 	pass

Rich> class b(baseclass):
Rich> 	pass

Rich> a.__myfunc__=b b.__myfunc__=a

Rich> __myfunc__ in a and b will reference class instances, not
Rich> functions, but who am I to quibble?  :)

Someone had suggested using nested_scopes earlier, but I think that
this is really slick :) thanks...
 -nld





More information about the Python-list mailing list