Tim Payne hat gesagt: // Tim Payne wrote:
> I was also wondering why so many of the variables are named like _name
> or _password? I've seen this sort of naming convention a lot in python,
> but I'm unsure of what cases this is used in.
These are a kind of "private" variables. Names starting with an _underscore
don't get imported if you do an "from foo import *"
Example:
--- foo.py ---
class foo:
"not private"
pass
class _foo:
"private"
pass
--- test-foo.py ---
from foo import *
bar = _foo()
try:
# will raise NameError:
bar = _foo()
except NameError:
print "_foo not defined"
bye,
--
__ __
Frank Barknecht ____ ______ ____ __ trip\ \ / /wire ______
/ __// __ /__/ __// // __ \ \/ / __ \\ ___\
/ / / ____/ / / / // ____// /\ \\ ___\\____ \
/_/ /_____/ /_/ /_//_____// / \ \\_____\\_____\
/_/ \_\
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss