Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
list.sort() returning None
#7
(Mar-18-2024, 10:39 AM)Pedroski55 Wrote: Smile Smile Smile

Dead_EyE: a very accurate shooter (and reader?)

Quote:You can also use the list.sort() method. It modifies the list in-place (and returns None to avoid confusion).

Big Grin Big Grin Big Grin

Seems, the "avoid confusion" part is not wholly true!

Explicit is better than implicit.

I've forgotten to post the link to the documentation: https://docs.python.org/3/library/stdtyp...#list.sort
But there I can't find the hint, that this method does return None.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
list.sort() returning None - by SmallCoder14 - Mar-17-2024, 10:53 PM
RE: list.sort() returning None - by perfringo - Mar-18-2024, 05:48 AM
RE: list.sort() returning None - by DeaD_EyE - Mar-18-2024, 10:20 AM
RE: list.sort() returning None - by Pedroski55 - Mar-18-2024, 10:39 AM
RE: list.sort() returning None - by DeaD_EyE - Mar-18-2024, 08:16 PM
RE: list.sort() returning None - by SmallCoder14 - Mar-18-2024, 06:27 PM
RE: list.sort() returning None - by deanhystad - Mar-18-2024, 07:57 PM
RE: list.sort() returning None - by Pedroski55 - Mar-19-2024, 03:46 PM
RE: list.sort() returning None - by SmallCoder14 - Mar-19-2024, 09:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 690 Apr-29-2024, 04:38 PM
Last Post: Calab
  returning a List of Lists nafshar 3 1,145 Oct-28-2022, 06:28 PM
Last Post: deanhystad
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,373 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
  list sort() function bring backs None CompleteNewb 6 4,257 Mar-26-2022, 03:34 AM
Last Post: Larz60+
  [solved] Sort list paul18fr 5 2,970 Aug-18-2021, 06:34 AM
Last Post: naughtyCat
  Sort List of Lists by Column Nju 1 12,982 Apr-13-2021, 11:59 PM
Last Post: bowlofred
  How to sort os.walk list? Denial 6 11,847 Oct-10-2020, 05:28 AM
Last Post: Denial
  2d List not returning DariusKsm 2 1,749 Sep-22-2020, 05:11 PM
Last Post: DariusKsm
  Need help returning min() value of list? edwdas 3 2,143 Nov-10-2019, 09:43 PM
Last Post: snippsat
  Converting to a list and sort tantony 6 3,329 Oct-07-2019, 03:30 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020