Should: "for k,v in **dictionary_instance" work?

keithgabryelski at gmail.com keithgabryelski at gmail.com
Fri Jun 15 15:17:25 EDT 2007


Does it make sense to provide this syntax for iterating key/value
pairs from a dictionary?

for k,v in **dict():
   print k,v

why is this not the same as:

for k,v in dict().items():
  print k,v

for that matter, why the heck doesn't a dictionary default to
returning a tuple
k,v pair from its iterator?

Pax, Keith

Ps, I'm sure someone has thought of these things before, probably been
answered before, but I'm sure I didn't find reference to them when i
searched.




More information about the Python-list mailing list