In article <baa0d11c-c999-4eee-9cf5-90ad667f5...@b25g2000prb.googlegroups.com>, EK <eka...@gmail.com> wrote: >On Aug 20, 2:10=A0pm, Peter Otten <__pete...@web.de> wrote: >> >> >>> from itertools import izip >> >>> it =3D iter([1,2,3,4,5,6]) >> >>> dict(izip(it, it)) >> >> {1: 2, 3: 4, 5: 6} > >dict(zip(*[iter(l)]*2))
No, that's not a good solution. For starters, it's less readable than Peter's version. More importantly, it has poor memory use because it needs to construct both the intermediate tuple and the zip() list. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "I support family values -- Addams family values" --www.nancybuttons.com -- http://mail.python.org/mailman/listinfo/python-list