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

For-Loop tuple destructuring #21724

Closed
oxinabox opened this issue May 6, 2017 · 3 comments
Closed

For-Loop tuple destructuring #21724

oxinabox opened this issue May 6, 2017 · 3 comments

Comments

@oxinabox
Copy link
Contributor

oxinabox commented May 6, 2017

I suggest that:

for (x, y) in zip(xs, ys)

Should also be allowed to be written:

for x, y in zip(xs, ys)

Just as:

(x, y) = first(zip(xs, ys))

can be written as

x,  y = first(zip(xs, ys))

this syntax is allowed in Python; and I've always expected it to work in julia, even now long after I last used python for anything.

Kinda related: #6614, #8522


I've been wanting this for a few years.
I always assumed there was an issue for it.
But after a concerted effort, I can not find one.
Though I still might have missed it.

@yuyichao
Copy link
Contributor

yuyichao commented May 6, 2017

I believe this is not allowed due to the the nested loop syntax for x in a, y in b which is not allowed in python. I'm not sure if there's a real ambituity thought it would be confusing when , means very different things in the for loop.

@quinnj
Copy link
Member

quinnj commented May 6, 2017

The original issue for this is #6484

@oxinabox
Copy link
Contributor Author

oxinabox commented May 6, 2017

Ah there it is.
I never tried searching on "breaking apart" I tried "unpacking" and "destructuring" and a few other things.

Closing as duplicate

@oxinabox oxinabox closed this as completed May 6, 2017
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