Skip to content

New PEP: Reduce-Map Comprehensions (and the "last" builtin) #609

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

Closed
wants to merge 11 commits into from

Conversation

petered
Copy link

@petered petered commented Apr 5, 2018

This PEP proposes the addition of new "Reduce-Map" comprehension. The Reduce-Map comprehension would perform a reduction while keeping intermediate elements. We also propose a built-in function "last", which, combined with a Reduce-Map comprehension, would allow us to replace the reduce builtin with a call to get the last element of a Reduce-Map generator.

Example:

smooth_signal = [average = (1-decay)*average + decay*x for x in signal from average=0.]

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@zware
Copy link
Member

zware commented Apr 5, 2018

Hi @petered, and thanks for your interest in improving Python. However, your proposal has some procedural issues and your draft document does not conform to the standard PEP format. See PEP 12 for a guide to PEP formatting.

First, though, you should raise this idea on the python-ideas@python.org mailing list. The folks there will give you valuable feedback, which can either be incorporated into your PEP or possibly convince you that your PEP isn't necessary.

You will also need to sign the CLA; see the message from @the-knights-who-say-ni above for details on that.

For now, I'm going to close this PR. After you've discussed the idea on python-ideas and the formatting is fixed, please feel free to open a new PR.

@zware zware closed this Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants