In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote:
> Erik Johnson wrote: > > "Erick" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >>Ah, you're running into the "old-style classes vs. new style classes". > >>Try subclassing from "object". > >> > >>For example: > >> > >>>>>class A(object): > > > > That works! :) I guess I am fortunate to be running 2.2 - looks kinda ugly > > prior to that. > > It's not horrible: > > py> class A: > ... pass > ... > py> class B: > ... pass > ... > py> a = A() > py> a.__class__ == A > True > py> a.__class__ == B > False Uh, isinstance(a, A) works for both new-style and old-style classes. Heck, isinstance() even works in Python 1.5.2... > Still, if you can use new-style classes, you should. > > Also, you should probably Google for "duck typing". Generally, in > Python it is frowned upon to check the type of an object. There are > times when it's necessary, but if you're just starting off, my guess is > that you haven't discovered one of these times yet... Just -- http://mail.python.org/mailman/listinfo/python-list