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

Skip-unpacking of selected tuple elements: for y,x, _, _, _, _ in P[2]: ... #23

Closed
Twenkid opened this issue Mar 20, 2019 · 1 comment
Closed

Comments

@Twenkid
Copy link
Collaborator

Twenkid commented Mar 20, 2019

Do you know that syntax trick? Probably a bit faster, too. If there are elements of a tuple that won't be used, they could be skipped (readability ("remindability") could be preserved with a comment):

  for y, x, _, _, _, _ in P[2]: #   y, x, i, dy, dx, g
                    map[y, x] = True

instead of the full form:

  for y, x, i, dy, dx, g in P[2]:
                    map[y, x] = True

It could be done for any of the positions:
for y, _, _, dy, _, g in P[2]: ... etc.

https://stackoverflow.com/questions/9532576/ignore-part-of-a-python-tuple

for y, x, i, dy, dx, g in P[2]:

@Twenkid Twenkid changed the title Skip-unpacking of selected tuple elements: for y,x, _, _, _, _ in P]2 Skip-unpacking of selected tuple elements: for y,x, _, _, _, _ in P[2]: ... Mar 20, 2019
@boris-kz
Copy link
Owner

boris-kz commented Mar 20, 2019 via email

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

No branches or pull requests

3 participants