Dictionary from list?

Andrew Dalke dalke at dalkescientific.com
Mon Oct 22 18:44:50 CEST 2001

> [Andrew Dalke]
> Not a core function, but
> would be handy.
>And Marcin Kowalczyk had some good abstract arguments -- but a concrete
>example somebody would actually use does more for me <wink>.

>So what should dictionary(x) do?

Oh, don't get me wrong.  I'm one of those anchors trying to slow
the development of new core features in Python.  (New libraries
is a different thing.)  If dictionary(list) stays an error you
won't hear any complaints about me.

But I'm also one of those people who likes details -- (forest?
tree?  I like the BARK! :) so thought it would be helpful
to point out other functions that returned a list of 2-ples.

>Note that the obvious workalike loop:
>d = {}
>for k, v in x:
>    d[k] = v

Yep.  Works for me.

                    dalke at dalkescientific.com

More information about the Python-list mailing list