Message209447
The docs are correct as-is. This is a documented and tested behavior.
>>> from heapq import nsmallest
>>> list(nsmallest(3, ['larry', 'georg', 'raymond', 'guido', 'tim'], key=len))
['tim', 'larry', 'georg']
The C implementation doesn't have a key-argument. That behavior gets added downstream in pure python in Lib/heapq.py which wraps the C-function and adds the additional behavior. |
|
Date |
User |
Action |
Args |
2014-01-27 15:09:50 | rhettinger | set | recipients:
+ rhettinger, georg.brandl, larry |
2014-01-27 15:09:50 | rhettinger | set | messageid: <1390835390.68.0.102570831271.issue20407@psf.upfronthosting.co.za> |
2014-01-27 15:09:50 | rhettinger | link | issue20407 messages |
2014-01-27 15:09:50 | rhettinger | create | |
|