wtanksle at dolphin.openprojects.net
Wed Aug 1 04:11:13 CEST 2001
On 31 Jul 2001 17:31:28 -0700, Aahz Maruch wrote:
>After seeing all the confusion about whether 'x in type' means
>isinstance() or issubclass(), my preference is for ripping this change
>out of CVS. The only way in which I think the 'in' operator makes sense
>is if you're trying to do
I disagree -- I think it belongs and will help a lot, as Guido has
described it. Some people will be minorly confused, but that's not
because of 'in'; it's just because of how they picture types.
I'm personally highly confused by the people who claim the operation
should be written as "class in object" rather than "object in class".
Objects don't in general contain classes; they always BELONG to classes.
Why would anyone say otherwise?
Also, "class in object" has a severe ambiguity: what if you're trying to
program using a list of classes? Then "myClass in myList" becomes
Finally, the question of using "subclass in class" isn't worth throwing
this out; I agree that this would be a useful operation to have a
shorthand for, but this isn't the right shorthand, since subclasses in
Python _are_ objects which do not necessarily belong to the same classes
as their instances.
The "right" shorthand would be yet another borrowed keyword -- but I have
no idea which one. Someone suggested ">=", but as Guido says, that
depends on how you view an inheretance tree.
It's a pity we don't have an "every" keyword, so we could use the syntax
"every subclass is class". Pretty, huh? :-)
> --- Aahz <*> (Copyright 2001 by aahz at pobox.com)
-William "Billy" Tanksley
More information about the Python-list