Type/Class Distinction

Martijn Faassen m.faassen at vet.uu.nl
Sat Jun 16 15:31:35 EDT 2001


Alex Martelli <aleaxit at yahoo.com> wrote:
> "Martijn Faassen" <m.faassen at vet.uu.nl> wrote in message
> news:9gdpbp$61k$6 at newshost.accu.uu.nl...
>    ...
>> Right now we have to *treat* 'types' differently from 'classes'. For
>> built-in objects you have to use the type() construct to check what
>> you're dealing with, but for class instances you use isinstance().
>>
>> Wouldn't it be nice if the language allowed something like this:
>>
>> if isinstance(foo, int):

> You're behind the times, I think (if I understand you correctly):

So I am! I wasn't aware this was the case. Does not seem to be mentioned in
Andrew Kuchling's 'What's new in Python 2.1'. Apparently we're on our
way already then.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list