On 11 Feb 2005, Xah Lee wrote:
> # this construct uses a irregular syntax to generate a expression
> # built by nested loops. Semantically, this expression generation is
> # akin to applying a function to a tree. Morons in the computing
> # industry and academia like to call this "list comprehens
# -*- coding: utf-8 -*-
# Python
# David Eppstein of the Geometry Junkyard fame gave this elegant
# version for returing all possible pairs from a range of n numbers.
def combo2(n):
return dict([('%d,%d'%(i+1,j+1),(i+1,j+1)) for j in range(n) for i
in range(j)])
print combo2(5)
# this constr