"Gabriel Genellina" <[email protected]> wrote:
> Ok, it's not strictly the same, but usually it doesn't hurt. The heaqp
> module doesn't promise anything about equal elements: it may keep the
> original order, rearrange them at will, reverse them, whatever.
The documentation doesn't say anything directly about stability, but the
implementation is actually stable. You can probably assume it must be at
least for nlargest and nsmallest otherwise the stated equivalence wouldn't
hold:
e.g. nsmallest documentation says:
Equivalent to: sorted(iterable, key=key)[:n]
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list