On Mon, May 16, 2016 at 2:00 AM, Grant Edwards
<grant.b.edwa...@gmail.com> wrote:
> On 2016-05-15, Michael Selik <michael.se...@gmail.com> wrote:
>> On Sun, May 15, 2016, 10:37 AM Grant Edwards <grant.b.edwa...@gmail.com> 
>> wrote:
>>> On 2016-05-15, Tim Chase <python.l...@tim.thechases.com> wrote:
>>>>
>>>> unless sorted() returns a lazy sorter,
>>>
>>> What's a lazy sorter?
>>
>> One that doesn't calculate the next item in the sequence until you
>> ask for it. It's impossible
>
> Why?  As long as the function has access to the entire sequence, it
> should be trivial.  Just find the min (or max) item in the sequence,
> remove it, then return it.  It's horribly inefficient, but...
>
>> unless you don't mind an approximation rather than correct sort.
>
> I have a feeling that I've missed the joke somewhere.

Sure, it's not impossible to implement, but generally the point of
lazy generation is that it's more efficient. Going from O(N log N)
with O(N) memory to O(N*N) with O(1) memory is not usually what you
want!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to