Skip to content

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

Closed

Description

@Jeroendevr

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

Activity

  1. JennaSys commented on Jul 4, 2024

    @JennaSys
    Collaborator

    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.

  2. JennaSys commented on Jul 4, 2024

    @JennaSys
    Collaborator

    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.

  3. self-assigned this
    on Jul 5, 2024
  4. JennaSys commented on Jul 17, 2024

    @JennaSys
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions