
[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! :-) Python 2.3.2 (#1, Nov 9 2003, 20:14:22) [GCC 3.3 20030226 (prerelease) (SuSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. from __future__ import nested_scopes, generators, division del __future__, fcntl, termios, joined, character, nested_scopes, generators, division sys.ps1 = '>>> ' from __future__ import nested_scopes, generators, division del __future__, fcntl, termios, joined, character, nested_scopes, generators, division sys.ps1 = '>>> '
0 in int Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: iterable argument required isinstance(0, int) True int <type 'int'>
-- François Pinard http://www.iro.umontreal.ca/~pinard