[Tutor] question concerning Boolean operators

Guba listsdl04 at yahoo.de
Fri Mar 21 00:32:21 CET 2008


Dear list,

from Guido's tutorial:

It is possible to assign the result of a comparison or other Boolean
expression to a variable. For example,

	>>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance'
	>>> non_null = string1 or string2 or string3
	>>> non_null
	'Trondheim'

How does this work?? How does Python know that we are looking for
non_null? After all, we don't provide this information here, right? (I
take non_null is a variable.)
I must be missing something... Can anyone help?

Many thanks,

Guba



More information about the Tutor mailing list