Classic and New Style Classes?
Chris S.
chrisks at NOSPAMudel.edu
Thu Jun 24 10:46:33 EDT 2004
Leif K-Brooks wrote:
> Chris S. wrote:
>
> I'm assuming you meant 'class something(whatever):' rather than def. If
> so, this should work:
>
>
> >>> class Foo(object):
> ... pass
> ...
> >>> isinstance(Foo, type)
> True
> >>> isinstance(Foo(), type)
> False
Yeah, minor typo. I needed to differentiate a class definition from a
class instance, and now I see using isinstance(obj,type) does the trick.
Thanks a lot.
More information about the Python-list
mailing list