Daniel Nogradi wrote:
> > > What is the simplest way to instantiate all classes that are
> > > subclasses of a given class in a module?
> > >
> > > More precisely I have a module m with some content:
> > >
> > > # m.py
> > > class A:
> > > pass
> > > class x( A ):
> > > pass
> > > class y(
> > What is the simplest way to instantiate all classes that are
> > subclasses of a given class in a module?
> >
> > More precisely I have a module m with some content:
> >
> > # m.py
> > class A:
> > pass
> > class x( A ):
> > pass
> > class y( A ):
> > pass
> > # all kinds of other o
> > >>> from inspect import isclass
> > >>>
> > >>> class x:
> > ... def __getattr__( self, attr ):
> > ... pass
> > ...
> > >>> y = x( )
> > >>> isclass( y )
> > True
>
> Which reinforces Michael Spencer's instinct that the inspect.isclass()
> implementation is a bit too clever
Wou
Daniel Nogradi wrote:
> Thanks, this looks pretty good. However there is some wierdness with
> isclass: whenever a class has a __getattr__ method an instance of it
> will be detected by isclass as a class (although it is not).
>
> >>> from inspect import isclass
> >>>
> >>> class x:
> ... de
> > More precisely I have a module m with some content:
> >
> > # m.py
> > class A:
> > pass
> > class x( A ):
> > pass
> > class y( A ):
> > pass
> > # all kinds of other objects follow
> > # end of m.py
> >
> > and then in another module I have currently:
> >
> > # n.py
> > import m
>
Daniel Nogradi wrote:
> What is the simplest way to instantiate all classes that are
> subclasses of a given class in a module?
>
> More precisely I have a module m with some content:
>
> # m.py
> class A:
> pass
> class x( A ):
> pass
> class y( A ):
> pass
> # all kinds of other objec
In <[EMAIL PROTECTED]>, Daniel Nogradi
wrote:
> More precisely I have a module m with some content:
>
> # m.py
> class A:
> pass
> class x( A ):
> pass
> class y( A ):
> pass
> # all kinds of other objects follow
> # end of m.py
>
> and then in another module I have currently:
>
> #
What is the simplest way to instantiate all classes that are
subclasses of a given class in a module?
More precisely I have a module m with some content:
# m.py
class A:
pass
class x( A ):
pass
class y( A ):
pass
# all kinds of other objects follow
# end of m.py
and then in another m