Re: [Python-3000] Iterating over a dict

2006-04-03 Thread Guido van Rossum
On 4/1/06, Thomas Lotze <[EMAIL PROTECTED]> wrote: > Hi, > > I wonder what's the reason for iterating over a dict by keys: > > >>> for x in {1:"a", 2:"b"}: > ... print x > ... > 1 > 2 > > I find it much more intuitive for the values, "a" and "b", to be accessed. > This is particularly confusing

Re: [Python-3000] Iterating over a dict

2006-04-03 Thread Georg Brandl
Guido van Rossum wrote: > On 4/1/06, Thomas Lotze <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I wonder what's the reason for iterating over a dict by keys: >> >> >>> for x in {1:"a", 2:"b"}: >> ... print x >> ... >> 1 >> 2 >> >> I find it much more intuitive for the values, "a" and "b", to be acces

Re: [Python-3000] Iterating over a dict

2006-04-02 Thread Guido van Rossum
On 4/2/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > A quick idea of mine: Wouldn't it be useful to maintain a list of what will > not change, collected in the discussions here? That way, people eager to > suggest > braces and whatnot can be referred to it. > > (I'd be volunteering to maintain suc

Re: [Python-3000] Iterating over a dict

2006-04-02 Thread Thomas Lotze
Am Sun, 02 Apr 2006 09:29:13 -0700 schrieb Guido van Rossum: > Just to confirm what's already been said, this was considered very > carefully and won't change. OK, thanks. -- Thomas ___ Python-3000 mailing list Python-3000@python.org http://mail.pyth

Re: [Python-3000] Iterating over a dict

2006-04-02 Thread Brett Cannon
On 4/2/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/2/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > > A quick idea of mine: Wouldn't it be useful to maintain a list of what will > > not change, collected in the discussions here? That way, people eager to > > suggest > > braces and whatno

Re: [Python-3000] Iterating over a dict

2006-04-01 Thread Greg Ewing
Thomas Lotze wrote: > The reason I ask this on the python-3000 list is that I wonder whether the > iterating behaviour of dicts might be changed in Python 3k, I doubt it. This issue was considered very carefully when support for iteration was added to dicts, and I'm not aware that the reasons for

Re: [Python-3000] Iterating over a dict

2006-04-01 Thread Terry Reedy
"Thomas Lotze" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The reason I ask this on the python-3000 list is that I wonder whether > the > iterating behaviour of dicts might be changed in Python 3k, so that in > the > above code, foo() would be applied to the dict's values. Di

Re: [Python-3000] Iterating over a dict

2006-04-01 Thread Benji York
Thomas Lotze wrote: > Hi, > > I wonder what's the reason for iterating over a dict by keys: I suspect that at least part of the reason is that given a key you can easily get the corresponding value, but given the value it's difficult to get the key. Seems like a good choice for "bare" dict ite

[Python-3000] Iterating over a dict

2006-04-01 Thread Thomas Lotze
Hi, I wonder what's the reason for iterating over a dict by keys: >>> for x in {1:"a", 2:"b"}: ... print x ... 1 2 I find it much more intuitive for the values, "a" and "b", to be accessed. This is particularly confusing as iterating over tuples, lists and sets in the same way does access t