'isa' keyword

Devan L devlai at gmail.com
Sat Sep 3 05:24:16 EDT 2005


talin at acm dot org wrote:
> Thanks for all the respones :) I realized up front that this suggestion
> is unlikely to gain approval, for reasons eloquently stated above.
> However, there are still some interesting issues raised that I would
> like to discuss.
>
> Let me first respond to a few of the comments:
>
> >What's the difference between this and ``isinstance`` ?
>
> What's the difference between 'in' and 'has_key()"? 1) Its shorter and
> more readable, 2) it can be overridden to mean different things for
> different container types.

Your analogy doesn't apply to non dictionaries. In any case, nothing
stops you from writing your own has_key() method for a different
container type. Likewise, if you made an isa keyword, it would just
call a method to have the traits you described above. You could write
your own method to see if it was an instance of the class, but it would
end up being more or less similar to isinstance().




More information about the Python-list mailing list