python - Pass more than 255 arguments to a function -
i'm passing arguments def
statement def
statement. did not know there limit amount of arguments can pass. i'm assuming arguments variables. need able pass more 255. can help me in layman terms how work around "more 255 arguments". thanks!
code:
def a(): "things happening" variable1 b(variable1) def b(variable1): "things happening" variable2 c(variable1, variable2) def c(variable1, variable2): "things happening" variable3 d(variable1, variable2, variable3) . . . def z5(variable1,...variable256): print result main()
python purposefully prevents passing more 255 arguments because code unweildy , hard maintain. if function needs many arguments (or close number), means there flaw in design.
if need +255 different values, should set them in list , create function take instead:
def z5(list_of_values): ... z5([val1, val2, val3, ...])
python function variables arguments
No comments:
Post a Comment