Python Forum
Sort Function: <' not supported between instances of 'float' and 'tuple'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort Function: <' not supported between instances of 'float' and 'tuple'
#1
Hello I have this list:

Output:
[((7.2, <__main__.bit object at 0x7f341d8b8700>), <__main__.port object at 0x7f344082cd00>), ((5.5, <__main__.bit object at 0x7f341d8b8790>), <__main__.port object at 0x7f34407aa190>)]
ANd I want to sort it with this code:

nextlist=[(next(ip),ip) for ip in ports]
        while len(nextlist)>0:
            nextlist.sort() 
But I have this error:

nextlist.sort()

TypeError: '<' not supported between instances of 'float' and 'tuple'

HOw to solve it
Reply


Messages In This Thread
Sort Function: <' not supported between instances of 'float' and 'tuple' - by quest - Apr-30-2021, 09:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python calculate float plus float is incorrect? sirocawa 6 98 1 hour ago
Last Post: DeaD_EyE
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,307 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
  list sort() function bring backs None CompleteNewb 6 4,092 Mar-26-2022, 03:34 AM
Last Post: Larz60+
  Tuple generator, and function/class syntax quazirfan 3 3,851 Aug-10-2021, 09:32 AM
Last Post: buran
Exclamation TypeError: '>=' not supported between instances of 'int' and 'str' helpme1 11 8,742 Mar-11-2021, 11:13 AM
Last Post: helpme1
  Combine Two Recursive Functions To Create One Recursive Selection Sort Function Jeremy7 12 7,314 Jan-17-2021, 03:02 AM
Last Post: Jeremy7
  How to use a tuple as an argument of a function zarox 5 3,551 Nov-14-2020, 08:02 PM
Last Post: buran
  code with no tuple gets : IndexError: tuple index out of range Aggam 4 2,793 Nov-04-2020, 11:26 AM
Last Post: Aggam
  Type error: '>' not supported between instances of 'NoneType' and 'int' spalisetty06 1 10,468 Apr-29-2020, 06:41 AM
Last Post: buran
  TypeError: '<' not supported between instances of 'str' and 'int' Svensation 5 8,777 Jan-20-2020, 08:12 PM
Last Post: buran

Forum Jump:

User Panel Messages

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