
On Jan 19, 2004, at 6:36 PM, François Pinard wrote:
[Guido van Rossum]
Marcin 'Qrczak' Kowalczyk <qrczak@knm.org.pl> writes:
Now thow in 'isinstance' as an old way to spell a specific membership test (for types and classes) which doesn't have to be learned about at all.
I love it. 'x in type' as a shorthand for isinstance(x, type). Checked into CVS!
The above exchange is dated 2001-07-31, and I'm merely glancing over some old saved email. The above feature does not seem to be implemented in Python 2.3.2, as demonstrated by the script below. Has it been retracted? Not that I really need it, however! :-)
I don't know what happened to this before, but I'd give it a -1.. it breaks some "fun" uses of metaclasses where you have a desire to use __contains__. For example, I use an enumeration class as a container for enumerators.. the enumeration metaclass implements __contains__, __getitem__, and a few other things. Anyways, why not: mytype in type(foo).mro() (and add support for old style classes, if you still use them) -bob