Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function Help
#2
compiled languages will give you a warning saying there is an unused parameter in testaddition function. However python does not do this. It is just garbaged collected anyways. 

Quote:I would just like to understand why the number of arguments does not matter when I run the program. 
function by nature, can take any number of arguments. In fact you can unpack a list of unknown number of arguments
lister = [1,2,3]

def func(*args):
    print(args[0])
    print(args[1])
    print(args[2])
    
func(*lister)
Recommended Tutorials:
Reply


Messages In This Thread
Function Help - by Millionsunz - Nov-26-2016, 05:12 AM
RE: Function Help - by metulburr - Nov-26-2016, 05:20 AM
RE: Function Help - by snippsat - Nov-26-2016, 08:42 PM
RE: Function Help - by wavic - Nov-27-2016, 05:12 AM
RE: Function Help - by snippsat - Nov-27-2016, 08:43 AM

Forum Jump:

User Panel Messages

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