[Python-Dev] semantics of subclassing things from itertools

Maciej Fijalkowski fijall at gmail.com
Thu Sep 10 14:50:33 CEST 2015


On Thu, Sep 10, 2015 at 10:26 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> On 10.09.15 10:23, Maciej Fijalkowski wrote:
>>
>> I would like to know what are the semantics if you subclass something
>> from itertools (e.g. islice).
>>
>> Right now it's allowed and people do it, which is why the
>> documentation is incorrect. It states "equivalent to: a function-or a
>> generator", but you can't subclass whatever it is equivalent to, which
>> is why in PyPy we're unable to make it work in pure python.
>>
>> I would like some clarification on that.
>
>
> There is another reason why itertools iterators can't be implemented as
> simple generator functions. All iterators are pickleable in 3.x.

maybe the documentation should reflect that? (note that generators are
pickleable on pypy anyway)


More information about the Python-Dev mailing list