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

Permit list comprehension–like filtering of for loops. #29

Open
amcgregor opened this issue Aug 7, 2019 · 0 comments
Open

Permit list comprehension–like filtering of for loops. #29

amcgregor opened this issue Aug 7, 2019 · 0 comments

Comments

@amcgregor
Copy link
Member

Where currently you require multiple lines with explicit flow control statements:

: for item in items
	: if item % 2 == 0
		: continue
	: end

Permit inclusion of filtering conditions (one or more) in the form:

: for item in items if item % 2

There are several avenues for translation to plain Python for these. Unwrap and reconstruct the multiple-line form, or alternatively wrap in a generator comprehension:

for item in (i for i in items if item % 2):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant