Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-14 Thread Serhiy Storchaka
On 10.09.15 15:50, Maciej Fijalkowski wrote: On Thu, Sep 10, 2015 at 10:26 AM, Serhiy Storchaka wrote: 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 th

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-13 Thread Maciej Fijalkowski
Hey Raymond I'm sorry you got insulted, that was not my intention. I suppose something like "itertools objects are implemented as classes internally, which means they're subclassable like other builtin types" is an improvement to documentation. On Mon, Sep 14, 2015 at 12:17 AM, Raymond Hettinger

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-13 Thread Raymond Hettinger
> On Sep 13, 2015, at 3:09 PM, Maciej Fijalkowski wrote: > > Well, fair enough, but the semantics of "whatever happens to happen > because we decided subclassing is a cool idea" is possibly the worst > answer to those questions. It's hard to read this in any way that isn't insulting. It was su

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-13 Thread Maciej Fijalkowski
On Sun, Sep 13, 2015 at 5:46 PM, Raymond Hettinger wrote: > >> On Sep 13, 2015, at 3:49 AM, Maciej Fijalkowski wrote: >> >>> The intended semantics are that the itertools are classes (not functions >>> and not generators). They are intended to be sub-classable (that is >>> why they have Py_TPFLA

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-13 Thread Raymond Hettinger
> On Sep 13, 2015, at 3:49 AM, Maciej Fijalkowski wrote: > >> The intended semantics are that the itertools are classes (not functions >> and not generators). They are intended to be sub-classable (that is >> why they have Py_TPFLAGS_BASETYPE defined). > > Ok, so what's completely missing from

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-13 Thread Maciej Fijalkowski
On Fri, Sep 11, 2015 at 1:48 AM, Raymond Hettinger wrote: > >> On Sep 10, 2015, at 3:23 AM, 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 >> doc

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-10 Thread Raymond Hettinger
> On Sep 10, 2015, at 3:23 AM, 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

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-10 Thread Terry Reedy
On 9/10/2015 3:23 AM, Maciej Fijalkowski wrote: Hi I would like to know what are the semantics if you subclass something from itertools (e.g. islice). I believe people are depending on an undocumented internal speed optimization. See below. Right now it's allowed and people do it, which i

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-10 Thread Maciej Fijalkowski
On Thu, Sep 10, 2015 at 10:26 AM, Serhiy Storchaka 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

Re: [Python-Dev] semantics of subclassing things from itertools

2015-09-10 Thread Serhiy Storchaka
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

[Python-Dev] semantics of subclassing things from itertools

2015-09-10 Thread Maciej Fijalkowski
Hi 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, w