This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年06月14日 15:04 by rengel, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg138322 - (view) | Author: Reinhard Engel (rengel) | Date: 2011年06月14日 15:04 | |
# Strange sort error # lst1 and lst 2 produce different results, but should be same # lst1 should sort by length of items, but doesn't, lst2 does! lst0 = ['ab-get-ratings-max', 'ab-get-ratings-min', 'ab-rate-position', 'accum', 'add-cops', 'add-new-dice', 'add-passing-move', 'add-plants', 'add-two', 'add-widget'] print lst0 lst1 = sorted(lst0, lambda x, y: len(y) > len(x)) print lst1 lst2 = sorted(lst0, lambda x, y: len(y) - len(x)) print lst2 |
|||
| msg138326 - (view) | Author: Reinhard Engel (rengel) | Date: 2011年06月14日 15:14 | |
Sorry, oversaw silly error in comparison! |
|||
| msg138329 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2011年06月14日 15:26 | |
... and you probably want sorted(lst0, key=len, reverse=True) anyway. :-) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:18 | admin | set | github: 56543 |
| 2011年06月14日 15:26:21 | mark.dickinson | set | nosy:
+ mark.dickinson messages: + msg138329 |
| 2011年06月14日 15:14:43 | rengel | set | status: open -> closed resolution: not a bug messages: + msg138326 |
| 2011年06月14日 15:04:03 | rengel | create | |