List Info

Thread: What is the meaning of using single underscore in front ofvariable name




What is the meaning of using single underscore in front ofvariable name
user name
2006-11-28 18:51:40
"Asrarahmed Kadri" <ajkadrigooglemail.com> wrote

> Single underscore as a prefix in variable naming...??
whats it for??
>
> Any idea..

Its a convention to indicate that this variable is not for
general 
use.
It is part of the internal implementation of the class or
module.

But it is only a convention and Python will not stop you
from
accessing it. It is similar to the convention of using all
uppercase
letters to indicate a constant value that should not be
changed
by users of the code.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://ww
w.freenetpages.co.uk/hp/alan.gauld



_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )