[Tutor] list (in)comprehensions

kevin parks cpsoct@lycos.com
Wed, 24 Jan 2001 19:31:03 +0900


The other thing that i am failing to understand is Python's new list comprehensions. They are new to 2.0 so are not discussed in any of the books that i have and the www.python.org site has very little on them, except for a few examples of someone fooling around with the interpreter. Some explanation would be helpful. I have been hacking lots of list processing tools and i have a feeling that they could all be rewritten more easily with list comprehensions if only i could (i can't say it) C O M P R E H E N D them (ok i said it). What are list comprehensions good for, what do they make easier, how to use them, etc. As a guy who uses map and filter everyday, it seems like something i better know. I sorely wish there was a howto with code and someone talking to me too! (Python documentation shouldn't just be a screenshot of someone's interpreter, though including an interactive session is helpful).

Thanks
and happy new year to everyone (year o' da snake it is!)

kevin parks
seoul, korea




Get your small business started at Lycos Small Business at http://www.lycos.com/business/mail.html