-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Do more work to prevent iterator invalidation for Dict's? #11316
Labels
design
Design of APIs or of the language itself
speculative
Whether the change will be implemented is speculative
Comments
Also #10116, which improved this situation. |
StefanKarpinski
added
design
Design of APIs or of the language itself
speculative
Whether the change will be implemented is speculative
labels
Aug 26, 2016
Ordered dicts might help this since modifying a dict does not change the iteration order in arbitrary ways. Especially if reassigning an existing key leaves it in the same order in the dict. It would take some careful design, but it might be possible to make it safe to mutate a dict while iterating it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
design
Design of APIs or of the language itself
speculative
Whether the change will be implemented is speculative
Should we try to do more to prevent iterator invalidation for Dict's (and possibly for other types as well)?
Contrast this Julia code:
with this Python code:
I would argue that Python's error is more helpful for debugging, although producing such an error requires making the iteration protocol do more run-time checking on every iteration to see whether the iterator has been invalidated.
Was this a conscious decision already made for the language? Skipping these kinds of checks does feel like the Julian way, but I wanted to confirm that this was intended behavior.
The text was updated successfully, but these errors were encountered: