Python Forum
Sort objects by protected properties.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort objects by protected properties.
#2
It would be helpful if you would keep your code together as a unit and reference by line numbers in your dialogue.

Is add_node method of AdjacencyList?

If so, I'm not sure about creating an instance of class (new_node) within method looks dangerous at minimum,
but my head is yelling at me that it's not going to be OK.

At a minimum, your sort would have to be on new_node, and not on a class definition (AdjacencyList)
thus the warning:
Quote:Access to a protected member _name of a class
Reply


Messages In This Thread
RE: Sort objects by protected properties. - by Larz60+ - Mar-17-2020, 04:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I need help writing this code for string properties and methods hannah71605 4 3,214 Mar-22-2021, 12:36 PM
Last Post: menator01
  how to sort a list without .sort() function letmecode 3 3,550 Dec-28-2020, 11:21 PM
Last Post: perfringo
  [split] Manual Sort without Sort function fulir16 2 3,268 Jun-02-2019, 06:13 AM
Last Post: perfringo
  Manual Sort without Sort function dtweaponx 26 49,593 Jun-01-2019, 06:02 PM
Last Post: SheeppOSU
  Creating a script with a class have specific properties dvldgs05 13 5,991 Oct-15-2018, 08:54 PM
Last Post: dvldgs05
  newbie questions about objects properties... slowbullet 2 2,719 Aug-12-2018, 01:12 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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