Message194712
changed iter(arg) to *arg
>>> import itertools
>>>
>>> class A(itertools.chain):
... @classmethod
... def from_iter(cls, arg):
... return cls(*arg)
...
>>> class B(A):
... pass
...
>>> B('ab', 'cd')
<__main__.B object at 0x7fc280e93cd0>
>>> b = B.from_iter(['ab', 'cd'])
>>> b
<__main__.B object at 0x7fc280e93d20>
>>> next(b)
'a'
>>> next(b)
'b'
>>> next(b)
'c'
>>> next(b)
'd'
>>> next(b)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
>>> |
|
Date |
User |
Action |
Args |
2013-08-09 01:13:57 | py.user | set | recipients:
+ py.user, rhettinger, terry.reedy, ezio.melotti, r.david.murray, docs@python, serhiy.storchaka |
2013-08-09 01:13:57 | py.user | set | messageid: <1376010837.17.0.322946398209.issue18301@psf.upfronthosting.co.za> |
2013-08-09 01:13:57 | py.user | link | issue18301 messages |
2013-08-09 01:13:56 | py.user | create | |
|