On 10/10/2019 12:40, Antoon Pardon wrote:
About including piped iterators:
     http://code.activestate.com/recipes/580625-collection-pipeline-in-python/

On 10/10/19 13:00, Paul Moore wrote:
As another measure, look at various other libraries on PyPI and ask
yourself why *this* library needs to be in the stdlib more than those
others. The answer to that question would be a good start for an
argument to include the library.

Well my answer would be that this library wouldn't add functionality
but rather would allow IMO for a more readable coding style.

If you split the work to be done over mulitple generators I find it
easier to understand when I read something like:

     for item in some_file | gen1 | gen2 | gen3:
         ...

than when I read something like:

     for item in gen3(gen2(gen1(somefile))):
         ...

With my ever-so-reactionary hat on, I have to say I'm the other way round. With "gen3(gen2(gen1(somefile)))" it's pretty obvious what's going on -- nested function or generator calls, probably the latter from the name. With "somefile|gen1|gen2|gen3" I need more context to kick my expectations out of the more common meaning of "|" as "or".

Yes, context demands that the "|" in your first example can't actually be an "or". It still causes a moment of logical disconnect (currently a long moment) that throws me out of understanding what your code is doing overall into what this line means in particular. It's exactly like coming across an unusual phrasing or iffy grammar in a piece of writing; you get thrown out of the reading experience by having to concentrate on the individual words.

Heh.  Literary criticism as applied to programming.  Only in Python...

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to