[Tutor] Test for type(object) == ???

Zachary Ware zachary.ware+pytut at gmail.com
Fri Feb 10 20:50:28 EST 2017


On Fri, Feb 10, 2017 at 7:34 PM, boB Stepp <robertvstepp at gmail.com> wrote:
> So my question is why does "type(5)" result in "<class 'int'>", but
> the correct Boolean test is "type(5) == int"?  I suspect it has
> something to do with the built-in attributes of Python objects that I
> currently know so very little about.

Try `help(repr)` and `int` on its own at the interactive prompt, and
see if that clarifies anything.  I hope that might be enough to nudge
you in the right direction, but if not, come back and ask :)

-- 
Zach


More information about the Tutor mailing list