Curious about library inclusion
Antoon Pardon
antoon.pardon at vub.be
Thu Oct 10 07:40:37 EDT 2019
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))):
...
or than when I have to include the work in the for suite
for line in somefile:
tmp1 = fun1(line)
tmp2 = fun2(tmp1)
item = fun3(tmp2)
...
or
for line in somefile:
item = fun3(fun2(fun1(line)))
I also would include these in the itertools module instead of adding an extra
module.
--
Antoon.
More information about the Python-list
mailing list