generator / iterator mystery

2011-03-13 Thread Dave Abrahams
27;b',n) for n in range(3)), ...(('c',n) for n in range(3)) )) [('a', 0), ('a', 1), ('a', 2), ('b', 0), ('b', 1), ('b', 2), ('c', 0), ('c', 1), ('c', 2)] >>> list(chain( *(((x,n) for n in range(3)) for x in 'abc') )) [('c', 0), ('c', 1), ('c', 2), ('c', 0), ('c', 1), ('c', 2), ('c', 0), ('c', 1), ('c', 2)] Huh? Can anyone explain why the last result is different? (This is with Python 2.6) Thanks in advance! -- Dave Abrahams BoostPro Computing http://www.boostpro.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido rethinking removal of cmp from sort method

2011-03-13 Thread Dave Abrahams
Steven D'Aprano pearwood.info> writes: > If anyone has any use-cases for sorting with a comparison function that > either can't be written using a key function, or that perform really > badly when done so, this would be a good time to speak up. I think it's probably provable that there are no