Serhiy Storchaka <storchaka+cpyt...@gmail.com> 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 <rep...@bugs.python.org>
<https://bugs.python.org/issue34508>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to