[issue13805] [].sort() should return self

Martin Häcker report at bugs.python.org
Tue Jan 17 11:21:52 CET 2012


New submission from Martin Häcker <spamfaenger at gmx.de>:

[].sort() returns None which means you can't chain it.

So for example someDict.keys().sort()[0] doesn't work but you have to use sorted(someDict.keys())[0] instead which is harder to read as you have to read the line not from the beginning to the end but jump back and forth in it to understand it (which gets progressively harder as the individual parts of it get longer / more complex).

----------
messages: 151439
nosy: dwt
priority: normal
severity: normal
status: open
title: [].sort() should return self
type: enhancement
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13805>
_______________________________________


More information about the Python-bugs-list mailing list