Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python built-in map() to support more than one iterable #862

Closed
Jeroendevr opened this issue Sep 23, 2023 · 3 comments
Closed

Python built-in map() to support more than one iterable #862

Jeroendevr opened this issue Sep 23, 2023 · 3 comments
Assignees

Comments

@Jeroendevr
Copy link

Currently the map() built in function is well supported, however it only works when passing one iterable. When passing two iterables the iterable result is null

Excpects

words = ("bike", "steer")

def func_1(prin):
    print(prin[0])

def func3(prin):
    print(prin[3])

function = (func_1, func3)

def apply(func: callable, word):
    func(word)

mapped = map(apply, function, words)

for x in mapped:
    x

---
b
e

Reality

null
null
@JennaSys
Copy link
Collaborator

JennaSys commented Jul 4, 2024

The way map is implemented right now, it only accepts a single iterable. But I'll take a look at expanding that to match CPython behavior.

@JennaSys
Copy link
Collaborator

JennaSys commented Jul 4, 2024

The new implementation of map should work correctly once v3.9.3 is deployed (currently it's only on the dev branch). Though, the variable function in the above example should be changed to functions so as not to confuse the JavaScript side of things.

@JennaSys
Copy link
Collaborator

Merged to master on PR #876

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants