2.2 features

Walter Dörwald walter at livinglogic.de
Fri Aug 3 09:00:30 EDT 2001


Guido van Rossum wrote:
>>>  if x in list: ...
>>>
>>>looks a lot more confusing.  I may withdraw this idea.
>>>
>>I'd think again.  The problem with isinstance and issubclass is that I
>>can never remember the order of the arguments.  Something
>>non-symmetric like "x in type" is much clearer to me, to read and to
>>write.
>>
> 
> Yes, it's clearer, but it leads to hypergeneralization (dare I ever
> use that word again? :-).
> 
> To remember isinstance() and isclass(), try to make a sentence out of
> it, like isinstance(x, y) <==> x is instance [of] y.

This would even be clearer, if isinstance and issubclass would be 
methods of object and type respectively, i.e.
   x.isinstance(y) or x.isinstanceof(y) or x.isa(y)
and
   c1.issubclass(c2)

Why invent new syntax?
-- 
Walter Dörwald · LivingLogic AG, Bayreuth/Germany · www.livinglogic.de




More information about the Python-list mailing list