Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

Paul Rubin at nospam.invalid
Fri Feb 19 06:26:52 CET 2010

Steve Howell <showell30 at> writes:
>> might be of interest.  Maybe Ruby and/or Python could grow something similar.
> Can you elaborate?

List comprehensions are a Python feature you're probably familiar with,
and I think Ruby has something like them too.  They originally came from
Haskell.  GHC (the main Haskell implementation) now supports an extended
list comprehension syntax with SQL-like features.  I haven't used it
much yet, but here's an example from a poker ranking program
( that I did as a Haskell exercise:

  let (winners:others) = 
        [zip c ls | ls <- lines cs
                , let {h = mkHand ls; c=classify h}
                , then group by c
                , then sortWith by Down c]

It's reasonably evocative and doing the same thing with the older
syntax would have been a big mess.  "Down" basically means sort
in reverse order.

More information about the Python-list mailing list