

McCarthy's amb operator in Python - coconutrandom
http://paddy3118.blogspot.com/2010/08/mccarthys-amb-operator-in-python.html

======
tmhedberg
Isn't this essentially what list comprehensions are for? For instance, here's
the Pythagorean triple example using a comprehension:

    
    
        [(a, b, c) for a in range(1, 11) for b in range(1, 11) for c in range(1, 11) if a ** 2 + b ** 2 == c ** 2]
    

I understand that the semantics are slightly different, but I'd argue that the
benefit of using a built-in, idiomatic Python construct instead of reinventing
the wheel is pretty clear.

Or am I missing something?

~~~
coconutrandom
I am definitely not the authority here, so someone correct me. This is giving
all combination of values that evaluate to True.

[edit]

More info here: <http://c2.com/cgi/wiki?AmbInPython>

