Skip to content

Introduce starstarmap#680

Closed
Skeen wants to merge 2 commits intomore-itertools:masterfrom
Skeen:master
Closed

Introduce starstarmap#680
Skeen wants to merge 2 commits intomore-itertools:masterfrom
Skeen:master

Conversation

@Skeen
Copy link
Copy Markdown
Contributor

@Skeen Skeen commented Feb 25, 2023

Issue reference

Closes #679

Changes

Introduces starstarmap

@DamianB-BitFlipper
Copy link
Copy Markdown

Just to give my 2 cents as a complete outsider, before I read up on the issue, I though that this function mapped and applied the arguments 2 layers deep.

Something akin to iterating [(1, 2), (3, 4)], [(5, 6, 7), (8,)] as fn(1, 2, 3, 4), fn(5, 6, 7, 8), if that makes sense.

After reading the issue, it makes total sense.

It seems that Python nomenclature calls the ** a "double star". I do not know if it will make the code more clear if it were doublestarmap. I am still iffy on this naming even.

@Skeen
Copy link
Copy Markdown
Contributor Author

Skeen commented Feb 25, 2023

I'm very open to renaming it doublestarmap. I have no strong attachment to the starstarmap name.

@bbayles What do you think?

Copy link
Copy Markdown

@ergoithz ergoithz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you didn't noticed, CI is complaining about your PR containing PEP8 violations, you'll have a higher chance of getting this PR approved after solving them. I annotated where those issues are coming from, hoping it helps.

list(mi.doublestarmap(lambda a, b: a+b, iterable))

def test_no_mapping(self):
iterable = [1,2,3,4]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8 violation: add space after ,


def test_adding(self):
iterable = [{'a': 1, 'b': 2}, {'a': 3, 'b': 4}]
actual = list(mi.doublestarmap(lambda a, b: a+b, iterable))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8 violation: add spaces around arithmetic operators

@@ -4392,6 +4393,24 @@ def gray_product(*iterables):
f[j] = f[j + 1]
f[j + 1] = j + 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8 violation: put two empty lines between module-level functions

"""
for item in iterable:
yield function(**item)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8 violation: use two empty lines between module-level functions

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider introducing starstarmap

4 participants