On Jan 2, 2011 4:15 PM, "Octavian Rasnita" <orasn...@gmail.com> wrote: > > > Octavian > > ----- Original Message ----- > From: "Alex Willmer" <a...@moreati.org.uk> > Newsgroups: comp.lang.python > To: <comp.lang.pyt...@googlegroups.com> > Cc: <python-list@python.org> > Sent: Sunday, January 02, 2011 8:07 PM > Subject: Re: list 2 dict? > > > > On Sunday, January 2, 2011 3:36:35 PM UTC, T wrote: > >> The grouper-way looks nice, but I tried it and it didn't work: > >> > >> from itertools import * > >> ... > >> d = dict(grouper(2, l)) > >> > >> NameError: name 'grouper' is not defined > >> > >> I use Python 2.7. Should it work with this version? > > > > No. As Ian said grouper() is a receipe in the itertools documentation. > > > > http://docs.python.org/library/itertools.html#recipes > > I know that, that is why I used: > > from itertools import * > > > Isn't enough? > > Octavian >
It would be, if, the function was actually a part of the itertools module. It isn't. It's just a code example used in the documentation.
-- http://mail.python.org/mailman/listinfo/python-list