Arguments, local variables, and global variables in Python

Posted by prosseek on Stack Overflow See other posts from Stack Overflow or by prosseek
Published on 2010-04-08T15:39:52Z Indexed on 2010/04/08 15:43 UTC
Read the original article Hit count: 640

Filed under:
|

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 _
_Global variable = 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?

© Stack Overflow or respective owner

Related posts about python

Related posts about coding-standards