List mapping?
Emile van Sebille
emile at fenx.com
Thu Apr 13 13:14:25 EDT 2000
More information about the Python-list mailing list
Thu Apr 13 13:14:25 EDT 2000
- Previous message (by thread): Doesn't anybody write to paper anymore?
- Next message (by thread): List mapping?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): Doesn't anybody write to paper anymore?
- Next message (by thread): List mapping?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list