My intuition has always been that the recipes, taking 'flatten' as an
excellent example, solve problems in a specific way that is not generally
considered to be the "right" way.  For example, should 'flatten' perform
one-level flattening or deep recursive flattening?  Should it handle
strings as single entities, or should it treat them as iterables?  What
about byte strings, should they be treated differently than strings or the
same?  I could go on, but you probably get the point...


On Mon, Nov 12, 2018 at 11:50 AM Nick Timkovich <prometheus...@gmail.com>
wrote:

> Not to derail the conversation, but I've always been curious why the
> itertools recipes are recipes and not ready-made goods (pre-baked?) that I
> can just consume. They're great examples to draw from, but that shouldn't
> preclude them from also being in the stdlib.
>
> On Mon, Nov 12, 2018 at 7:41 PM Michael Selik <m...@selik.org> wrote:
>
>>
>>
>> On Sat, Nov 10, 2018 at 6:56 PM Jonathan Crall <erote...@gmail.com>
>> wrote:
>>
>>> Sometimes there's a good, useful function than doesn't get added because
>>>> there's no reasonable place to put it. For example, a "flatten"
>>>> function
>>>> has been talked about since Python 1.x days, and we still don't have a
>>>> standard solution for it, because (1) it isn't clear *precisely* what
>>>> it
>>>> should do, and (2) it isn't clear where it should go.
>>>
>>>
>>> The flatten example is good to know about. Is there a link to this
>>> discussion or a summary of it? I would think flatten could go in itertools,
>>> but clearly there must some reason why its not there. I imagine the
>>> duplication with it.chain.from_iter + "There should be one-- and preferably
>>> only one --obvious way to do it."?
>>>
>>
>> https://docs.python.org/3/library/itertools.html#itertools-recipes
>> There's an example of ``flatten`` in the itertools recipes.
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas@python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to