[Python-ideas] Integrate some itertools into the Python syntax

Michel Desmoulin desmoulinmichel at gmail.com
Tue Mar 22 08:58:41 EDT 2016



Le 22/03/2016 08:34, Graham Gower a écrit :
> On 22 March 2016 at 16:19, Michael Selik <mike at selik.org> wrote:
>>
>>
>>> On Mar 21, 2016, at 7:06 PM, Michel Desmoulin <desmoulinmichel at gmail.com> wrote:
>>> if you need more, then you need itertools. Few people know about it, so I
>>> usually see duplicate loops and conversion to lists/tuples.
>>
>> Why do you think the new syntax you're suggesting will be more discoverable and therefore more well known than the itertools module?
> 
> And consider the other side of the coin. If I read code using a
> function of the itertools module, its easy to look up the definition;
> if I read code featuring a rarely used syntax, how easy is it to come
> up with search engine terms to describe the syntax, and thus find
> documentation for the feature?
> 

I see your point. Again, this is the weakest point of my proposal, we
should not discard all of it just because of that.

And maybe we can come up with something better.

E.G: I suggested before that iter() returns objects with advanced
semantics for [:] as an alternative to add slicing to generators.

Maybe the same objects can come with a chain() method, which is
explicit. Or provide an additional builtin function, which does help
with those issues if changing iter() is not possible.


More information about the Python-ideas mailing list