Brian Quinlan wrote: > George Sakkis wrote: >> Perhaps this has been brought up in the past but I couldn't find it in >> the archives: far too often I use the idiom dict(zip(keys,values)), or >> the same with izip. How does letting dict take two positional >> arguments sound ? >> >> Pros: >> - Pretty obvious semantics, no mental overhead to learn and remember it. >> - More concise (especially if one imports itertools just to use izip). >> - At least as efficient as the current alternatives. >> - Backwards compatible. >> >> Cons: > - Yet Another Way To Do It > - Marginal benefit > > Also note that the keyword variant is longer than the zip variant e.g. > > dict(zip(keys, values)) > dict(keys=keys, values=values) > > and the relationship between the keys and values seems far less obvious > to me in the keyword variant. > Unfortunately
dict(keys=keys, values=values) == {keys: values} regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Blog of Note: http://holdenweb.blogspot.com See you at PyCon? http://us.pycon.org/TX2007 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com