[Python-ideas] Dict(x, y) -> Dict(zip(x, y))
Franklin? Lee
leewangzhong+python at gmail.com
Mon Feb 15 04:44:13 EST 2016
Does it make code more readable? What about simply defining `dictzip` or
`dict2` for yourself?
On Feb 14, 2016 9:44 PM, "Bruce Leban" <bruce at leban.us> wrote:
>
> this would have:
>
> >>> dict(((1,2),(3,4)))
> {1: 2, 3: 4}
>
> >>> dict(((1,2),(3,4)), ((5,6)))
> {(1, 2): 5, (3, 4): 6}
>
> in other words, the interpretation of the first argument to dict is
entirely different if there is a second argument than if there isn't one.
There is precedent for that in ``range``.
(Sorry for the double mail, Bruce.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160215/0515e480/attachment.html>
More information about the Python-ideas
mailing list