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
#1
Hello, this might be a strange question but I was wondering if I can give a hint about
the tuple argument items. For isntance, in the example bellow:

# I don't want 2 arguments
def matchObjects(source=None, target=None):
    pass

# I want one argument like this
def matchObjects(objects=(None, None)):
    pass
The thing that I don't like in the tuple argument "objects=(None, None)" is that unless you read the docstring
you don't know which item is the source and which one is the target.
Is it possible to make that tuple more explicit about what it represents?

I am using python 2.7.

thanks
R
Reply


Messages In This Thread
Being explicit about the items inside a tuple argument - by rudihammad - Dec-04-2019, 05:37 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  search in dict inside tuple steg 1 644 Mar-29-2023, 01:15 PM
Last Post: rob101
  Calculate the sum of the differences inside tuple PUP280 4 1,149 Aug-12-2022, 07:20 PM
Last Post: deanhystad
  How to check if my argument is a tuple with 3 tuples zarox 1 1,794 Nov-15-2020, 06:50 PM
Last Post: DougBTX
  How to use a tuple as an argument of a function zarox 5 3,460 Nov-14-2020, 08:02 PM
Last Post: buran
  code with no tuple gets : IndexError: tuple index out of range Aggam 4 2,725 Nov-04-2020, 11:26 AM
Last Post: Aggam
  SyntaxError: positional argument follows keyword argument syd_jat 3 5,728 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,115 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,159 May-11-2019, 03:18 AM
Last Post: keames
  Iterate a tuple with dict inside anna 2 2,374 Feb-13-2019, 03:44 PM
Last Post: anna
  convert non-string with explicit base jacklee26 5 16,055 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