Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25792
| Date | 2012-07-21 22:01 -0400 |
|---|---|
| From | Dave Angel <d@davea.name> |
| Subject | Re: My first ever Python program, comments welcome |
| References | <pZqdnadVUa-EY5fNnZ2dnUVZ7rednZ2d@bt.com> <mailman.2395.1342899651.4697.python-list@python.org> <500b4a27$0$29978$c3e8da3$5496439d@news.astraweb.com> <500B5DC4.7020204@mrabarnett.plus.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2415.1342922527.4697.python-list@python.org> (permalink) |
On 07/21/2012 09:56 PM, MRAB wrote: > On 22/07/2012 01:32, Steven D'Aprano wrote: >> On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote: >> >>> On 21/07/2012 20:08, Lipska the Kat wrote: >>>> l=sorted(l, key=itemgetter(0)) >>> >>> Short is: >>> >>> l.sort(key=itemgetter(0)) >> >> Shorter, and the semantics are subtly different. >> >> The sorted function returns a copy of the input list. >> >> The list.sort method sorts the list in place. >> > Since the result is bound to the original name, the > result is the same. > In this particular program, yes. But if there's another variable bound to the same list, then the fact that there's a new object from sorted() makes a difference. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
My first ever Python program, comments welcome Lipska the Kat <lipska@lipskathekat.com> - 2012-07-21 20:08 +0100
Re: My first ever Python program, comments welcome Ian Foote <ian@feete.org> - 2012-07-21 20:34 +0100
Re: My first ever Python program, comments welcome MRAB <python@mrabarnett.plus.com> - 2012-07-21 20:40 +0100
Re: My first ever Python program, comments welcome Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-22 00:32 +0000
Re: My first ever Python program, comments welcome MRAB <python@mrabarnett.plus.com> - 2012-07-22 02:56 +0100
Re: My first ever Python program, comments welcome Chris Angelico <rosuav@gmail.com> - 2012-07-22 11:59 +1000
Re: My first ever Python program, comments welcome Dave Angel <d@davea.name> - 2012-07-21 22:01 -0400
Re: My first ever Python program, comments welcome Dave Angel <d@davea.name> - 2012-07-21 16:10 -0400
Re: My first ever Python program, comments welcome Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-22 00:56 +0000
Re: My first ever Python program, comments welcome rusi <rustompmody@gmail.com> - 2012-07-21 19:55 -0700
Re: My first ever Python program, comments welcome Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-07-22 09:14 +0100
Re: My first ever Python program, comments welcome Lipska the Kat <lipska@lipskathekat.com> - 2012-07-22 10:20 +0100
Re: My first ever Python program, comments welcome rusi <rustompmody@gmail.com> - 2012-07-22 09:18 -0700
Re: My first ever Python program, comments welcome Lipska the Kat <lipska@lipskathekat.com> - 2012-07-22 18:23 +0100
Re: My first ever Python program, comments welcome rusi <rustompmody@gmail.com> - 2012-07-23 22:13 -0700
Re: My first ever Python program, comments welcome Lipska the Kat <lipskathekat@yahoo.co.uk> - 2012-07-24 12:34 +0100
Re: My first ever Python program, comments welcome Lipska the Kat <lipska@lipskathekat.com> - 2012-07-22 09:37 +0100
Re: My first ever Python program, comments welcome Andrew Berg <bahamutzero8825@gmail.com> - 2012-07-22 03:49 -0500
Re: My first ever Python program, comments welcome Chris Angelico <rosuav@gmail.com> - 2012-07-22 20:17 +1000
Re: My first ever Python program, comments welcome Lipska the Kat <lipska@lipskathekat.com> - 2012-07-22 13:36 +0100
Re: My first ever Python program, comments welcome David <bouncingcats@gmail.com> - 2012-07-22 20:46 +1000
Re: My first ever Python program, comments welcome Peter Otten <__peter__@web.de> - 2012-07-22 09:56 +0200
Re: My first ever Python program, comments welcome "Ivan@work" <ivan.cvetkovic@pakel.hr> - 2012-07-23 09:12 +0200
csiph-web