Friday 15 May 2015

Python: Best way to deal with functions with long list of arguments? -


I have passed a long list of arguments in a function but have found many detailed explanations, but I still suspect that If the proper way to do this

In other words, I suspect that I am doing this wrong, but I do not know how to do it correct

Problem: I have (not too much) recursive function, which uses a lot of variables and some of them need to modify some content.

How did I end up with:

  def myFunction (alpha, beta, gamma, zeta, alphalist, betalist, gamma list, zeta list): & lt; Some operations & gt; My Function (alpha, beta, modagaama, zeta, mode alfalfaist, betalist, gamma list, modegetist)   

... and I want to see changes made on the original variable (just pass in the CI There is a reference, but I have heard that it is always a copy in Python?).

Sorry, if I do not know this question about the phrase, then I can find the related answers.

You should place myfunction in a class. Set up the square with appropriate attributes and call appropriate functions. Then the state is well rooted in the class.

No comments:

Post a Comment