Q:

bug in finding biggest element of a set

can someone explain to me why I have this result?
>>> a = set([(0, 1), (1, 0), (0, 0)])    
>>> b = set([(1, 2), (2, 0), (0, 2), (2, 1), (1, 1)])    
>>> max(a,b)    
set([(0, 1), (1, 0), (0, 0)])
>>> max(b,a)
set([(1, 2), (2, 0), (0, 2), (2, 1), (1, 1)])

A:

For sets, a < b means a is a subset of b. Neither of your two sets is a subset of the other, so they're considered "equally large" and that's why you always just got the first argument.
Demo of set sorting:
>>> sorted([{5,6,7,8,9}, {1,2,3}, {1,2}, {1}, {1,2,3,4}])
[{8, 9, 5, 6, 7}, {1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}]

Here, {5,6,7,8,9} is neither a subset nor a superset of any of the others, so it's considered equally large and since it's at the beginning and the sort function is stable, it stays at its place. The other four however get sorted nicely, because {1} is a subset of {1,2}, etc.
However, since there's no total ordering among sets, sorting them is partially unpredictable. For example, here the {5,6,7,8,9} does get moved to another position:
>>> sorted([{1,2,3}, {1,2}, {5,6,7,8,9}, {1}, {1,2,3,4}])
[{1}, {1, 2}, {1, 2, 3}, {8, 9, 5, 6, 7}, {1, 2, 3, 4}]

If you want to sort sets another way, for example by size, then just use the appropriate key:
>>> sorted([{1,2,3}, {1,2}, {5,6,7,8,9}, {1}, {1,2,3,4}], key=len)
[{1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}, {8, 9, 5, 6, 7}]

>>> max([{1,2,3}, {1,2}, {5,6,7,8,9}, {1}, {1,2,3,4}], key=len)
{8, 9, 5, 6, 7}

