Benjamin Peterson writes:

 > > I suppose there's no way to get the compiler to both make "for x in d"
 > > work as above, and make "for k, v in d" be equivalent to Python 2's
 > > "for k, v in d.iteritems()"?

 > That doesn't make sense. What if your keys are tuples?

Oh, I still think it makes sense.  Both x and k would be bound to the
key tuples.  For example it would "work" consistently with Common Lisp
multiple values.  And it's not clear to me that unpacking key tuples
would be used anywhere near as often as item unpacking.

But Python doesn't have other objects that behave like Common Lisp
multiple values, and it would change the meaning of currently correct
programs, so it's a non-starter.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to