__module__ / scoping question

Aahz aahz at pythoncraft.com
Fri Feb 28 18:43:11 CET 2003


In article <mailman.1046068446.5754.python-list at python.org>,
Clark C. Evans <cce at clarkevans.com> wrote:
>
>class foo:
>    def __init__(self,x):
>        self.x = x
>class bar:
>    def foo(self):
>        return __module__.foo(self)

How about assuming that the above is in a module called 'xyzzy.py':

import xyzzy
class bar:
    def foo(self):
        return xyzzy.foo(self)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Register for PyCon now!  http://www.python.org/pycon/reg.html




More information about the Python-list mailing list