List mapping?

Emile van Sebille emile at fenx.com
Thu Apr 13 13:14:25 EDT 2000


While this does work, it is slower and harder
to see what's going on.

Emile van Sebille
emile at fenx.com
-------------------


----- Original Message -----
From: Nick Trout <nick at spam_me_notvideosystem.co.uk>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Thursday, April 13, 2000 8:20 AM
Subject: Re: List mapping?


> > Try this:
> > mylist = ['/a','1','/b','2','/c','3']
> > map(lambda x: reduce(lambda a, b: (a,b), mylist[x:x+2]), range(0,
> > len(mylist), 2))
>
> Very good! I wasnt familiar with the reduce function. I would
certainly not have
> come up with something of this complexity.
>
> This begs the question: Is there an archive of code snippets for
Python? These
> could form an excellent tutorial. Quite a few messages arrive on this
newsgroup
> asking for good starting points for Python (and thats just the people
who come
> here and ask).
>
> N
>
>
> --
> http://www.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list