[issue41107] Running a generator in a map-like manner

2020-06-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, you can already do this with map() and deque():

   deque(map(f, it), maxsize=0)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41107] Running a generator in a map-like manner

2020-06-24 Thread Natsumi H.


Natsumi H.  added the comment:

If it won't be added do you reckon creating a library to solve this issue would 
be appropriate?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41107] Running a generator in a map-like manner

2020-06-24 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I don't think something so obvious can be added, if you want a one liner you 
can write:

for e in iterable: f(e)

I think it would go in itertools if it were accepted.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41107] Running a generator in a map-like manner

2020-06-24 Thread Natsumi H.


Natsumi H.  added the comment:

Exactly that was the plan!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41107] Running a generator in a map-like manner

2020-06-24 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
components: +Library (Lib) -Interpreter Core

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41107] Running a generator in a map-like manner

2020-06-24 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

If I'm understanding correctly you want:

def xmap(f, iterable):
for e in iterable:
f(e)


Is that correct?

--
nosy: +remi.lapeyre

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41107] Running a generator in a map-like manner

2020-06-24 Thread Natsumi H.


New submission from Natsumi H. :

I suggest adding a function which behaves like map but without returning 
anything to iterate over a generator.

This is useful in cases where you need to run a function on every element in a 
list without unnecessarily creating a generator object like map would. 

I think given the existence of the map function that this should be added to 
Python.

--
components: Interpreter Core
messages: 372275
nosy: natsuwumi
priority: normal
severity: normal
status: open
title: Running a generator in a map-like manner
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com