Python Forum
Supplying 2 arguments to 3-argument function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Supplying 2 arguments to 3-argument function
#1
I have the following piece of code
		def visit(self, path, rootf, extraf): 
			return extraf(path, path.parent().visit(rootf, extraf))
I wonder how can it work if function visit takes 3 parameters but recursive call supplies only two.
Reply
#2
The first parameter is self, which is auto-populated with the current instance.
Reply
#3
(Sep-10-2017, 04:55 PM)nilamo Wrote: The first parameter is self, which is auto-populated with the current instance.

I obviously understand this when count only 3 arguments out of total 4: self, path, rootf and extraf. I see that recursion supplies only last two but not path. Can you explain that?
Reply
#4
Maybe the parent is a different class, that only expects two parameters?

Otherwise, it wouldn't run, since there's no default values.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  mutable argument in function definition akbarza 1 482 Dec-15-2023, 02:00 PM
Last Post: deanhystad
  calling external function with arguments Wimpy_Wellington 7 1,436 Jul-05-2023, 06:33 PM
Last Post: deanhystad
Information How to take url in telegram bot user input and put it as an argument in a function? askfriends 0 1,093 Dec-25-2022, 03:00 PM
Last Post: askfriends
  i want to use type= as a function/method keyword argument Skaperen 9 1,861 Nov-06-2022, 04:28 AM
Last Post: Skaperen
  Regex - Pass Flags as a function argument? muzikman 6 3,597 Sep-06-2021, 03:43 PM
Last Post: muzikman
  'namespace' shorthand for function arguments? shadowphile 5 2,599 Aug-11-2021, 09:02 PM
Last Post: shadowphile
  Checking the number of arguments a function takes Chirumer 3 2,160 Jul-06-2021, 04:56 PM
Last Post: Chirumer
  Possible to dynamically pass arguments to a function? grimm1111 2 2,187 Feb-21-2021, 05:57 AM
Last Post: deanhystad
  How to use a tuple as an argument of a function zarox 5 3,608 Nov-14-2020, 08:02 PM
Last Post: buran
  calling a function and argument in an input phillup7 3 2,614 Oct-25-2020, 02:12 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

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