What's the difference between VAR and _VAR_?
Erik Max Francis
max at alcyone.com
Fri Sep 9 00:25:33 EDT 2005
Johnny Lee wrote:
> I'm new in python and I was wondering what's the difference between
> the two code section below:
>
> (I)
> class TestResult:
> _pass_ = "pass"
> _fail_ = "fail"
> _exception_ = "exception"
>
> (II)
> class TestResult:
> pass = "pass"
> fail = "fail"
> exception = "exception"
>
> Thanks for your help.
There's nothing per se different between a variable named 'x' and one
named '_x_'. The difference here is that pass is a keyword, so
pass = 'pass'
is illegal.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
Experience is the name everyone gives to their mistakes.
-- Oscar Wilde
More information about the Python-list
mailing list