Comparing variable types

Kill Bill bill at kill.com
Sat Oct 25 22:50:21 EDT 2003


Can you tell me where you found that method in the docs?  I'm having trouble
navigating them, the java docs are so much easier to look at.

"KefX" <keflimarcusx at aol.comNOSPAM> wrote in message
news:20031025224446.20009.00000076 at mb-m07.aol.com...
> >type(i) == "<type 'float'>"
> >this always returns false.  How come?
> >type(i)returns <type 'float'> if i is a float so why isn't == working?
>
> Use isinstance(), like this:
> isinstance(i, float)
> This will return True if i is a float, False if not.
>
> - Kef






More information about the Python-list mailing list