[Python-Dev] decorate-sort-undecorate
Barry Warsaw
barry at python.org
Wed Oct 15 15:25:32 EDT 2003
More information about the Python-Dev mailing list
Wed Oct 15 15:25:32 EDT 2003
- Previous message: [Python-Dev] decorate-sort-undecorate
- Next message: [Python-Dev] decorate-sort-undecorate
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 2003-10-15 at 13:52, Guido van Rossum wrote: > > While we're hacking on [].sort(), how horrible would it be if we > > modified it to return self instead of None? > > -1000. This is non-negotiable. Sniff. >>> class mylist(list): ... def sort(self, *args, **kws): ... super(mylist, self).sort(*args, **kws) ... return self ... >>> mylist([5, 4, 3, 2, 1]) [5, 4, 3, 2, 1] >>> x = mylist([5, 4, 3, 2, 1]) >>> x.sort() [1, 2, 3, 4, 5] Bliss. -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20031015/d011f721/attachment.bin
- Previous message: [Python-Dev] decorate-sort-undecorate
- Next message: [Python-Dev] decorate-sort-undecorate
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list