On Sun, Dec 15, 2013 at 8:50 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Should we expect (ignoring pathological cases) the assertion > ‘type(obj) is obj.__class__’ to hold true? If not, under what > circumstances would it be sensible for those to differ?
They differ on old-style classes (in 2.x): the type will be either classobj or instance; and the __class__ doesn't exist (for class objects) or is what you'd expect (for instances). This isn't particularly pathological, so I disagree with the suggestion that one should always definitely use type() for style reasons. -- Devin -- https://mail.python.org/mailman/listinfo/python-list