On Wed, Oct 23, 2019 at 7:03 AM Todd <toddr...@gmail.com> wrote:

> On Sat, Apr 7, 2018 at 4:48 AM Paul Moore <p.f.mo...@gmail.com> wrote:
>
>> On 7 April 2018 at 08:44, Raymond Hettinger <raymond.hettin...@gmail.com>
>> wrote:
>> > Agreed that the "chain([x], it)" step is obscure.  That's a bit of a
>> bummer -- one of the goals for the itertools module was to be a generic
>> toolkit for chopping-up, modifying, and splicing iterator streams (sort of
>> a CRISPR for iterators).  The docs probably need another recipe to show
>> this pattern:
>> >
>> >         def prepend(value, iterator):
>> >             "prepend(1, [2, 3, 4]) -> 1 2 3 4"
>> >             return chain([value], iterator)
>> >
>> > Thanks for taking a look at the proposal.  I was -0 when it came up
>> once before. Once I saw a use case pop-up on this list, I thought it might
>> be worth discussing again.
>>
>> I don't have much to add here - I typically agree that an explicit
>> loop is simpler, but my code tends not to be the sort that does this
>> type of operation, so my experience is either where it's not
>> appropriate, or where I'm unfamiliar with the algorithms, so terseness
>> is more of a problem to me than it would be to a domain expert.
>>
>> Having said that, I find that the arguments that it's easy to add and
>> it broadens the applicability of the function to be significant.
>> Certainly, writing a helper is simple, but as Tim pointed out, the
>> trick to writing that helper is obscure. Also, in the light of the
>> itertools design goal to be a toolkit for iterators, I often find that
>> the tools are just slightly *too* low level for my use case - they are
>> designed to be combined, certainly, but in practice I find that
>> building my own loop is often quicker than working out how to combine
>> them. (I don't have concrete examples, unfortunately - this feeling
>> comes from working back from the question of why I don't use itertools
>> more than I do). So I tend to favour such slight extensions to the use
>> cases of itertools functions.
>>
>> A recipe would help, but I don't know how much use the recipes see in
>> practice. I see a lot of questions where "there's a recipe for that"
>> is the answer - indicating that people don't always spot the recipes.
>>
>
> Part of the problem with the recipes is, as far as I am aware, the
> license.  The recipes appear to be under the Python-2.0 license, which
> complicates the licensing of any project you use them in that isn't already
> under that license.
>

That can be solved. We could explicitly license the recipes in the docs
under a simpler license. Please start a new thread, as this one has
attracted too much spam.

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RMJKNJHMZZ7P4WDO6SMHQDMFWEV3XBL5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to