Reputation: 4687
Is there a stylistic rule to call variables?
For example variables between different functions with same destination.
My question is about names in signatures of functions.
name = 'somevalue1'
path = 'some/value'
process(name, path)
What about names in signature? They should be same
def process(name, path):
...
Or maybe something like that:
def process(_name, _path)
...
Or
def process(name1, path1)
...
Upvotes: 4
Views: 126
Reputation: 31250
For example variables between different functions with same destination.
It is important to realize that the variables in the calling function and the variables in the called function's signature have nothing to do with each other, and therefore it's perfectly fine to give them the same name if they mean the same thing.
If you have a name and a path, and a function that takes them as arguments, then it's a fine a choice to name them that:
def process(name, path):
(not that "process" itself is a good name, of course, but it's your example).
Then inside another function, you also have a name and a path. Of course, "name" and "path" are also great variables there! And you can use them to call process(). There's no reason whatsoever to use different names, they don't get in each other's way.
Upvotes: 1