Python Forum
Being explicit about the items inside a tuple argument
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Being explicit about the items inside a tuple argument
#2
You could use a collections.namedtuple
>>> from collections import namedtuple
>>> Pair = namedtuple('Pair', 'source target')
>>>
>>> def matchObjects(pair=Pair(source=None, target=None)):
...     print(pair)
... 
Reply


Messages In This Thread
RE: Being explicit about the items inside a tuple argument - by Gribouillis - Dec-04-2019, 06:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  search in dict inside tuple steg 1 712 Mar-29-2023, 01:15 PM
Last Post: rob101
  Calculate the sum of the differences inside tuple PUP280 4 1,203 Aug-12-2022, 07:20 PM
Last Post: deanhystad
  How to check if my argument is a tuple with 3 tuples zarox 1 1,836 Nov-15-2020, 06:50 PM
Last Post: DougBTX
  How to use a tuple as an argument of a function zarox 5 3,648 Nov-14-2020, 08:02 PM
Last Post: buran
  code with no tuple gets : IndexError: tuple index out of range Aggam 4 2,847 Nov-04-2020, 11:26 AM
Last Post: Aggam
  SyntaxError: positional argument follows keyword argument syd_jat 3 5,852 Mar-03-2020, 08:34 AM
Last Post: buran
  How to get first line of a tuple and the third item in its tuple. Need Help, Anybody? SukhmeetSingh 5 3,217 May-21-2019, 11:39 AM
Last Post: avorane
  How to pass a dictionary as an argument inside setup function of unittest nilaybnrj 1 3,212 May-11-2019, 03:18 AM
Last Post: keames
  Iterate a tuple with dict inside anna 2 2,436 Feb-13-2019, 03:44 PM
Last Post: anna
  convert non-string with explicit base jacklee26 5 16,323 Nov-06-2018, 06:50 AM
Last Post: jacklee26

Forum Jump:

User Panel Messages

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