Python Forum
list approach due nested order
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
list approach due nested order
#2
Since the order doesn't matter, you might want to consider using a set of frozensets:
>>> unique = set()
>>> unique.add(frozenset(['a', 'b']))
>>> unique.add(frozenset(['b', 'a']))
>>> unique.add(frozenset([1, 2]))
>>> unique
{frozenset({'a', 'b'}), frozenset({1, 2})}
Reply


Messages In This Thread
list approach due nested order - by 3Pinter - Oct-07-2019, 08:44 AM
RE: list approach due nested order - by stranac - Oct-07-2019, 08:49 AM
RE: list approach due nested order - by 3Pinter - Oct-07-2019, 09:54 AM
RE: list approach due nested order - by Gribouillis - Oct-07-2019, 10:15 AM
RE: list approach due nested order - by 3Pinter - Oct-07-2019, 01:41 PM
RE: list approach due nested order - by Gribouillis - Oct-07-2019, 01:46 PM
RE: list approach due nested order - by 3Pinter - Oct-07-2019, 01:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What is a faster way to deep copy a nested list without using .deepcopy()? Shervin_Ataeian 1 1,805 Oct-13-2024, 01:28 PM
Last Post: Pedroski55
  Advice needed on how to approach this problem... sawtooth500 1 1,521 Apr-06-2024, 01:55 PM
Last Post: snippsat
  Copying the order of another list with identical values gohanhango 7 2,893 Nov-29-2023, 09:17 PM
Last Post: Pedroski55
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 3,180 May-22-2023, 10:39 PM
Last Post: ICanIBB
  List all possibilities of a nested-list by flattened lists sparkt 1 1,889 Feb-23-2023, 02:21 PM
Last Post: sparkt
  Updating nested dict list keys tbaror 2 2,054 Feb-09-2022, 09:37 AM
Last Post: tbaror
  Python Program to Find the Total Sum of a Nested List vlearner 8 8,592 Jan-23-2022, 07:20 PM
Last Post: menator01
  Looping through nested elements and updating the original list Alex_James 3 3,064 Aug-19-2021, 12:05 PM
Last Post: Alex_James
  Order a list with successive permutations based on another list yvrob 3 3,914 Mar-19-2021, 08:20 AM
Last Post: supuflounder
  Group List Elements according to the Input with the order of binary combination quest_ 19 9,870 Jan-28-2021, 03:36 AM
Last Post: bowlofred

Forum Jump:

User Panel Messages

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