Serhiy Storchaka <[email protected]> added the comment:
> It would need a special case so that `for x in *a, *b:` doesn't first
> construct a tuple of all elements in a and b. Thoughts?
It may be surprising that `for x in *a, *b:` behave differently from `for x in
(*a, *b):`.
It is idiomatic to create a list of keys and iterate it if you want to modify
the dict during iterating:
for key in list(d):
# modify d
This can be written in a form
for key in [*d]:
# modify d
or
for key in (*d,):
# modify d
(although the latter variant is slightly slower).
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34508>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com