Is 'isinstance()' the right thing?
Erik Max Francis
max at alcyone.com
Tue Apr 30 13:54:00 EDT 2002
Ralf Juengling wrote:
> Thanks, I wasn't aware of these (looked for them in the type module).
I agree, operator seems a strange place for them.
> *BUT*, these (eg. isSequenceType) work only for C extension types,
> right?
No, they work with any object:
>>> import operator
>>> operator.isSequenceType([1, 2, 3])
1
>>> class MyList(list): pass
...
>>> operator.isSequenceType(MyList())
1
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Life is one long process of getting tired.
\__/ Samuel Butler
Interstelen / http://www.interstelen.com/
A multiplayer, strategic, turn-based Web game on an interstellar scale.
More information about the Python-list
mailing list