On Tue, Mar 15, 2011 at 2:00 AM, Paul Rubin <no.email@nospam.invalid> wrote:
> Ian Kelly <ian.g.ke...@gmail.com> writes:
>> I would think that you can sort them with key as long as none of the
>> sequences are equal (which would result in an infinite loop using
>> either method).  Why not this?
>
> Yes you can do something like that, but look how ugly it is compared
> with using cmp.

Actually, how would you do it with cmp?  You would need to tee off the
iterators in some way so that each comparison gets the same data as
the last one, which sounds like a major hassle.

Or were you talking about passing in generator functions rather than
generator objects and reinitializing them for each comparison?  If
that's the case then the key version can be a fair amount simpler
since you wouldn't need to bother with caching.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to