Aug-07-2020, 05:55 PM
(This post was last modified: Aug-07-2020, 05:55 PM by deanhystad.)
Python does it this way because when you call a function you can treat key value arguments as position arguments.
def mixedbag(pos1, pos2, keyvalue1=1, keyvalue2=2): pass mixedbag(1, 2, 3, 4) # This is allowed. pos1=1, pos2=2, keyvalue1=3, keyvalue2=4If you ere allowed to intermix position and key value arguments the mapping of these values would become confused:
def mixedbag(pos1, keyvalue1=1, pos2, keyvalue2=2): pass mixedbag(keyvalue2 = 1, 2, 3) # Who gets 1?