Reverse zip() ?

Janto Dreijer jantod at gmail.com
Wed Dec 3 16:08:52 CET 2008


I'd like to point out that since your where thinking in terms of
matplotlib, you might actually find numpy's own transpose useful,
instead of using zip(*seq) :)

untested:

t = linspace(0,2*pi*3)
seq = asarray(zip(t, sin(t)))

t, y = seq.T # or seq.transpose() or numpy.transpose(seq)
pylab.plot(t,y)

Regards
Janto

Andreas Waldenburger wrote:
> On Wed, 3 Dec 2008 02:11:51 -0800 (PST) alex23 <wuwei23 at gmail.com>
> wrote:
>
> > On Dec 3, 6:51 pm, Andreas Waldenburger <geekm... at usenot.de> wrote:
> > > On Tue, 02 Dec 2008 18:16:13 -0800 Bryan Olson
> > > > zip as its own inverse might be even easier to comprehend if we
> > > > call zip by its more traditional name, "transpose".
> > >
> > > Sounds like a Py4k change to me.
> >
> > Nah, just add the following to your sitecustomize.py:
> >
> >    transpose = zip
> >
> > :)
>
> Gaaahh!
>
> :)
> /W
>
> --
> My real email address is constructed by swapping the domain with the
> recipient (local part).



More information about the Python-list mailing list