Help understanding the decisions *behind* python?

Joshua Bronson jabronson at
Fri Jul 31 13:02:55 EDT 2009

On Jul 22, 7:55 am, Duncan Booth < at invalid.invalid> wrote:
> I find it interesting that the heapq functions tell you in the
> documentation that they aren't suitable for use where n==1 or where n is
> near the total size of the sequence whereas random.sample() chooses what it
> thinks is the best algorithm based on the input. At the very least I would
> have thought the heapq functions could check for n==1 and call min/max when
> it is.

I've had the same thought myself a number of times, so I filed a bug:

More information about the Python-list mailing list