A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-February/070859.html below:

[Python-Dev] dict(keys, values)

[Python-Dev] dict(keys, values)George Sakkis george.sakkis at gmail.com
Thu Feb 1 10:48:21 CET 2007
On 2/1/07, Brian Quinlan <brian at sweetapp.com> 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.
>
> Cheers,
> Brian
>

Um, you do realize that dict(keys=keys, values=values) is already
valid and quite different from dict(zip(keys, values)), don't you ? :)

George
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4