Timeline for Sorting strings by length - functional Python
Current License: CC BY-SA 2.5
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 29, 2013 at 19:36 | comment | added | Bakuriu |
Nitpicking: the space between the = when using keyword arguments is not PEP8 compliant.
|
|
Jan 24, 2012 at 21:17 | comment | added | Tadeck |
If you do not need to reuse len (eg. you need it only for sorting), you can use simply: sorted(data, key=len) . If you need it later, you can do it in two steps, to improve readability: 1) data_sorted = sorted(data, key=len) , 2) result = zip(data_sorted, map(len, data_sorted)) .
|
|
Feb 26, 2011 at 17:49 | history | edited | Winston Ewert | CC BY-SA 2.5 |
added 427 characters in body
|
Feb 26, 2011 at 16:39 | comment | added | Mauricio Scheffer | @Winston Ewert: just need to display that information. | |
Feb 26, 2011 at 16:37 | comment | added | Winston Ewert | @Mauricio Scheffer, so you are just printing this list out? Why do you need the string lengths in there? | |
Feb 26, 2011 at 16:34 | comment | added | Mauricio Scheffer | @Winston Ewert: just printing it to screen. | |
Feb 26, 2011 at 16:24 | comment | added | Winston Ewert | @Mauricio Scheffer, what are you doing with it afterwards? | |
Feb 26, 2011 at 5:03 | vote | accept | Mauricio Scheffer | ||
Feb 26, 2011 at 0:48 | history | answered | Winston Ewert | CC BY-SA 2.5 |