alwayssortedlist (was Re: On PEP 322 (ireverse))

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Mon Nov 3 20:31:17 EST 2003


> From: Alex Martelli [mailto:aleax at aleax.it]
> 
> > Not only is it not effective, but heaps don't keep their elements in
> > sorted order... so if you wanted a list to stay sorted, heaps aren't
> 
> Please don't "top-post": somebody reading your reply can't see what
> you ARE responding to.  Putting your comments AFTER the phrase you're
> commenting on is much kinder to readers.
> 
> I said a heap is "not effective" (as a way to sort, in Python) because
> the sort method of lists is so much faster.  You CAN use a heap to
> sort, it's just not an _effective_ way to perform sorting in Python.

I'd argue that Alex. It may not be an "efficient" or "elegant" way to sort in Python, but there's not denying that it is "effective" - it does the job correctly. If you don't go out of your way to muck it up ;)

Tim Delaney





More information about the Python-list mailing list