something wrong with isinstance

Paul McGuire ptmcg at austin.rr.com
Thu Feb 12 14:56:40 EST 2009


On Feb 12, 12:26 pm, maksym.ka... at gmail.com wrote:
>
> Well the output of
>
> > print(type(obj))
> > print(str(obj))
>
> was
>
> <class 'worldmap.GeoMap'>
> <worldmap.GeoMap object at 0x01DD17B0>
>
> Just looks well, isn't it? i have no idea what's wrong

So then how do you know isinstance is evaluating to False?  And why do
you return None if it evals to True?  Can you drop a print command
inside the if block just before returning None, and another print just
before returning the default default?

I also would recommend using a debugger like winpdb when in a spot
like this - despite the name, it is not Windows-only, and you can step
through this code and evaluate variables and expressions inline.

-- Paul



More information about the Python-list mailing list