Why is it different from the example on the tutorial?

Chris Angelico rosuav at gmail.com
Sun Jul 6 10:45:04 EDT 2014


On Mon, Jul 7, 2014 at 12:34 AM, Roy Smith <roy at panix.com> wrote:
> * You can print type(foo), to find out exactly what it is (useful when
> even printing repr() doesn't explain what's going on).

And very VERY occasionally, print(id(type(foo))) comes in handy,
because two types might look the same, but an isinstance check looks
(modulo subclassing) at type identity. :) But yes, the info Roy listed
is normally what you'll be wanting.

ChrisA



More information about the Python-list mailing list