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

2012-01-17 Thread Martin Häcker
New submission from Martin Häcker : [].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 jum

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

2012-01-17 Thread Martin Häcker
Martin Häcker added the comment: It really should return self. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

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

2012-01-17 Thread Ezio Melotti
Ezio Melotti added the comment: This is by design. Methods that mutate the object return None. Methods that create a new object return the new object. list.sort sorts the list in place, so it returns None. -- nosy: +ezio.melotti resolution: -> rejected stage: -> committed/rejected sta

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

2012-01-17 Thread Ezio Melotti
Ezio Melotti added the comment: See also http://docs.python.org/faq/design.html#why-doesn-t-list-sort-return-the-sorted-list -- ___ Python tracker ___ _