__module__ / scoping question

Clark C. Evans cce at clarkevans.com
Mon Feb 24 01:47:02 EST 2003


I'd like to do something like...

class foo:
    def __init__(self,x):
        self.x = x
class bar:
    def foo(self):
        return __module__.foo(self)

So that the "foo" method of the "bar" object
returns a "foo" object.  Yes, I could rename
the outer "foo" to something else... but any
other ideas?

Clark





More information about the Python-list mailing list