help on ultra newbie program please

cybernut cybernut at uswest.net
Wed May 21 16:42:37 EDT 2003


"Erik Max Francis" <max at alcyone.com> wrote in message
news:3ECBD492.8F4F2EB9 at alcyone.com...
> cybernut wrote:
>
> > What does that mean? if something == , != ect. something: makes sense
> > to me,
> > but is that some kind of shortcut ...
>
> if (and other condition-testing structures) just tests whether or not
> the expression is "true."  In Python, everything is considered true
> except None, False, numeric zeroes, empty builtin container types
> (strings, tuples, lists, dictionaries, etc.), and custom types which
> override their __nonzero__ or __len__ methods appropriately:
>
> http://www.python.org/doc/current/lib/truth.html#l2h-78
>
> if x == y: ...
>
> is simply a special case of this, because the expression (x == y)
> returns a value which is considered true if x equals y, and one
> considered false otherwise.
>
> -- 
>    Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
>  __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
> /  \ People say that life is the thing, but I prefer reading.
> \__/  Logan Pearsall Smith

Yeah I understand that, but I didn't understand what that part in his code
was doing exactly because it isnt something like
"if x == y:"

It was just
if password_ok:

Thats like saying if x:

So Im not sure what that is doing exactly because it doenst seem to be
comparing anything or checking to see if something is true or not. I know it
works in the program, but dont understand what it is and why.






More information about the Python-list mailing list