Curious about library inclusion

Antoon Pardon antoon.pardon at vub.be
Thu Oct 10 06:34:45 EDT 2019


That seems to have been thoruoghly garbled so I start again.

I was wondering how likely it would be that piped iterators like shown
in http://code.activestate.com/recipes/580625-collection-pipeline-in-python/
would make it into a future python version/ Once I started using them
(and included some more) I found I really liked using them. For instance
I used to write the following a lot: for line in some_file: line =
line.strip() lst = line.split(':') do_stuff(lst) Now I seem to drift
into writing: for lst in some_file | Strip | Split(':'): do_stuff(lst)
where Strip and Split are defined as follows: Strip =
Map(methodcaller('strip')) def Split(st): return
Map(methodcaller('split', st)) I also found that Apply can be used as a
decorator, that easily turns a generator into a piped version. So what
are the odds? -- Antoon.




More information about the Python-list mailing list