Sunday January 20, 2008

A Comprehension

This is to announce that I just used my very first list comprehension in Python.  And I liked it!

[I hereby predict that somebody will leave the comment, "You've just taken your first step into a larger world."]

I am The Tensor, and I approve this post.
02:24 PM in Computers | Submit: | Links:

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c88ad53ef00e54fe94ddd8833

Listed below are links to weblogs that reference A Comprehension:

Comments

I encountered that while doing a report on python for a programming languages course. I was brand new to python, having only studied Java and C/C++ at the time. I guess "love at first sight" is an accurate depiction of how I felt.

Posted by: Jason at Jan 20, 2008 9:05:11 PM

I'm lobbying for legalization of polygamy just so I can marry Python.

Posted by: Hamilton Lovecraft at Jan 21, 2008 10:36:46 AM

I know!! I love these and use them every chance I get. I like to use nested for loops and conditionals inside them. There is also a trick (which I don't really use) to reference the list itself during its creation: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/204297

Posted by: Levi at Jan 21, 2008 3:36:46 PM

Haskell is sexier because it allows infinite-length lists. :)

Posted by: Darryl McAdams at Jan 23, 2008 11:56:06 PM

Post a comment