Python Forum
Organizing list of objects by attribute
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Organizing list of objects by attribute
#3
Thank you. That was a great response. Very very helpful.

I had initially went with the set methods because I wanted to eventually add in a Joker card which the user could input value and suit. I guess I could just use something like the following to achieve that:

def assign_joker(joker_card):
# FUNCTION CALLED TO TAKE USER INPUT FOR CARD VALUE / SUIT (OMITTED), THEN RETURN THE CARD
# PROPERLY ASSIGNED AS FOLLOWS

     return (joker_card = Card(chosen_value, chosen_suit))
Reply


Messages In This Thread
RE: Organizing list of objects by attribute - by scarney1988 - Mar-07-2020, 04:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Organizing several similar classes with overlapping variables 6hearts 7 1,689 May-07-2023, 02:00 PM
Last Post: 6hearts
  Creating list of lists, with objects from lists sgrinderud 7 1,887 Oct-01-2022, 07:15 PM
Last Post: Skaperen
Question Keyword to build list from list of objects? pfdjhfuys 3 1,765 Aug-06-2022, 11:39 PM
Last Post: Pedroski55
  AttributeError: 'list' object has no attribute 'upper' Anldra12 4 5,300 Apr-27-2022, 09:27 AM
Last Post: Anldra12
  How to store the resulting Doc objects into a list named A xinyulon 1 2,012 Mar-08-2022, 11:49 PM
Last Post: bowlofred
  AttributeError: 'list' object has no attribute 'values' ilknurg 4 15,555 Jan-19-2022, 08:33 AM
Last Post: menator01
  Grouping and sum of a list of objects Otbredbaron 1 3,443 Oct-23-2021, 01:42 PM
Last Post: Gribouillis
  Passing List of Objects in Command Line Python usman 7 3,431 Sep-27-2020, 03:45 PM
Last Post: ndc85430
  How to create and define in one line a 2D list of class objects in Python T2ioTD 1 2,194 Aug-14-2020, 12:37 PM
Last Post: Yoriz
  How do I get attribute XPATHs list ? MDRI 3 3,106 Jun-24-2020, 07:28 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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