In python, there is no way to differentiate between arguments, local variables, and global variables. The easy way to do so might be have some coding convention such as
- Global variables start with _ and capital letter
- arguments end with with _
_Gvariable = 10 def hello(x_, y_): z = x_ + y_
Is this a Pythonian way to go? I mean, is there well established/agreed coding-standards to differentiate them in python?
=== ADDED ===
I just want to discriminate between arguments and local variables. As arguments are given from outside, and more like a ROM in the sense that it is not assumed to be read only. C++ provides the const keyword to prevent the arguments from changing, but not for python. I thought appending _ can be one of a way to mimic this feature in python.
copymodule on the objects you pass in as arguments, so that you're passing in a copy instead of the actual object. Though, that could be confusing, too. Probably best just to write code that does exactly what you want it to, and write unittests to ensure that.