Determining if an object is a class?
Nick Vatamaniuc
vatamane at gmail.com
Thu Jul 13 02:58:42 EDT 2006
Clay,
Search Google for it. Here is one good explanation with code examples
by Michael Fotsch:
http://www.geocities.com/foetsch/python/new_style_classes.htm
Nick V.
placid wrote:
> Clay_Culver at yahoo.com wrote:
> > I need to find out if an object is a class. Using new style classes
> > this is very easy:
> >
> > class Test(object): pass
> >
> > obj = Test
> > or
> > obj = Test()
> >
> > if type(obj) == type:
> > # this is a class object..
> > else:
> > # this not a class object
> >
> > But this fails for old style classes. For example:
> >
> > class OldStyleObject: pass
> >
>
> Why is there old and new classes? What are the differences?
>
> --Cheers
More information about the Python-list
mailing list