On Oct 22, 2:21 pm, Peter Pearson <ppear...@nowhere.invalid> wrote: > On Fri, 22 Oct 2010 07:49:39 -0700 (PDT), Brendan wrote: > > [snip] > > > > > > > x.py > > class X(object): > > pass > > > y.py > > import x > > class Y(x.X): > > pass > > > z.py > > import x > > import y > > class ZX(x.X): > > pass > > class ZY(y.Y): > > pass > > > w.py > > import x > > import y > > import z > > class WX(x.X): > > pass > > class WY(y.Y): > > pass > > class WZX(z.ZX): > > pass > > class WZY(z.ZY): > > pass > > >>>> import x, y, z, w > >>>> dir(x) > > ['X', '__builtins__', '__doc__', '__file__', '__name__', > > '__package__'] > >>>> dir(y) > > ['Y', '__builtins__', '__doc__', '__file__', '__name__', > > '__package__', 'x'] > >>>> dir(z) > > ['ZX', 'ZY', '__builtins__', '__doc__', '__file__', '__name__', > > '__package__', 'x', 'y'] > >>>> dir(w) > > ['WX', 'WY', 'WZX', 'WZY', '__builtins__', '__doc__', '__file__', > > '__name__', '__package__', 'x', 'y', 'z'] > > I apologize for being dense, but I don't understand what bothers > you about this behavior. Yes, module w imports x, and therefore > w.x exists. Is that bad? > > -- > To email me, substitute nowhere->spamcop, invalid->net.- Hide quoted text - > > - Show quoted text -
No worries. I am the one who is dense. What bothers me is that I have not noticed this before when importing other Python modules. I use Python sporadically, and frequently use the dir command to learn or remind myself of class methods. Python examples/tutorials on classes always show everything(classes and subclasses) in the same module. -- http://mail.python.org/mailman/listinfo/python-list