Re: [Tutor] question concerning Boolean operators

2008-03-20 Thread Alan Gauld
"Guba" <[EMAIL PROTECTED]> wrote > >>> 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 informa

Re: [Tutor] question concerning Boolean operators

2008-03-20 Thread Steve Willoughby
On Thu, Mar 20, 2008 at 04:55:17PM -0700, jim stockford wrote: > >>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance' > >>> jackson = string1 or string2 or string3 > >>> jackson > 'Trondheim' The key here is the "or" operator which, in an expression like a or b will return a if

Re: [Tutor] question concerning Boolean operators

2008-03-20 Thread jim stockford
i'm guessing assignment, which actually associates a reference, will skip referencing an identifier to a null and will make the association (assignment) to the first non-null value in the expression, which is string2 in this case. that the identifier is non_null is immaterial; you could write

[Tutor] question concerning Boolean operators

2008-03-20 Thread Guba
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