-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 bug? #5917
Comments
You might be using a syntax I'm not familiar with, but it seems like you want to use
That produces: cat is blue |
Why its needed to be used "zip" for doing that? I know that python also use it, but It wouldn't be more intuitive to only use a tuple?. |
Tuples are iterable: Assignment to tuples discards superflous elements, julia> (a,b) Combine the two and you get the behavior above. @johnmyleswhite described the solution. |
Thanks now i understand what was happening! |
That's a pretty weird behavior, I have to say. I kind of wish this failed rather than producing unexpected behavior. The most suspect thing is the destructuring and discarding trailing values. |
Didn't mean to reopen. Wrong button. @github – please move the open/close buttons somewhere else. Having them next to the comment submission form is a horrible place. |
Crosslinking #837, for a discussion about being explicit when ignoring trailing members of a tuple returned from a function. I think it will help correctness if there was some special syntax to ignore trailing elements in a tuple assignment, and Python apparently does require exact match on number of elements. |
+1 for exact match. How about a, b, rest... = sometuple (Deja vu... I think we had this discussion somewhere else a little while |
I like the My concerns here are (1) you might want to extend functions to return more values without breaking client code, and (2) checking for exact match is less efficient since we'd have to generate extra code to check that no more values remain. |
I have the following code:
And the result its a little bit strange, Should this be happening (Version 0.3.0-prerelease)?. This also have problem with numbers:
The text was updated successfully, but these errors were encountered: