Way to pass multiple parameters to a function in python

前端 未结 6 1766
遇见更好的自我
遇见更好的自我 2021-02-06 09:12

I have written a python script which calls a function. This function takes 7 list as parameters inside the function, something like this:

def WorkDetails(link, A         


        
6条回答
  •  不思量自难忘°
    2021-02-06 09:44

    That you need to pass that many lists is a sign that your function is not doing just one thing and you should refactor it by breaking it into smaller functions and/or converting it to a class. You can pass parameters as keywords, or pass an arbitrary number of parameters to a function, as described by this StackOverflow page, but it'll still be hard for others to read and understand if you have your function do more than one thing.

提交回复
热议问题