On Fri, Oct 23, 2020, 1:28 PM Alex Hall > Breaking millions of lines of idiomatic code seems like a bad idea. >> >> a, b, c = mydict >> >> Mary not be so very common, but this is ubiquitous: >> >> for k in mydict: ... >> > > What I mean is that maybe `a, b = foo` could first test if `foo` is a > mapping, use mapping unpacking if it is, otherwise fall back to regular > iterable unpacking. >
Unpacking *IS* iteration. You are suggesting adding brand new special semantics for this one case that breaks the conceptual model of Python. Also that still breaks quite a bit of existing code, even if not as much as the loop version.
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/PVKQ3HV65O4ZCML2CPROE4CHYSPPNMXF/ Code of Conduct: http://python.org/psf/codeofconduct/
