[Baypiggies] Newbie-ish type questions...
p at ulmcnett.com
Wed Apr 23 18:59:34 CEST 2008
Chad Netzer wrote:
> * Note - I have no idea how isSequenceType() deals with iterators or
> generators... Does someone have a few moments to test this?
I was unaware of the operator module - thanks!
>>> import operator
>>> l = [1,2,3]
>>> i = iter(l)
>>> g = (item for item in l)
>>> print l, i, g
[1, 2, 3] <listiterator object at 0x6c590> <generator object at 0x6db70>
>>> map(operator.isSequenceType, (l, i, g))
[True, False, False]
This is with Python 2.5.2.
More information about the Baypiggies