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

Alex Kleider akleider at sonic.net
Fri Feb 10 20:58:25 EST 2017


On 2017-02-10 17:34, boB Stepp wrote:
> I was playing around with type() tonight.  .........

I've also "played around" with this subject-
Here's a source:
http://stackoverflow.com/questions/152580/whats-the-canonical-way-to-check-for-type-in-python

... and a successful experiment:
alex at X301n3:~$ python3
Python 3.4.3 (default, Nov 17 2016, 01:11:57)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> type(5) is int
True
>>> isinstance(5, int)
True


More information about the Tutor mailing list