Re: Boolean confusion

2007-05-09 Thread Greg Corradini
nt to check wether one string is a substring of an other, use the in >operator. >>> '.' in '020914A' and len('020914A') > 10 False >>> len('020914A') > 10 and '.' in '020914A' False Thank you Diez and Antoon for demystifing this problem. I see where I've been going wrong. -- View this message in context: http://www.nabble.com/Boolean-confusion-tf3715438.html#a10393765 Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list

Re: Boolean confusion

2007-05-09 Thread Greg Corradini
; > and it's just returned by the and. > > in python, and is implemented like this (strict evaluation > nonwithstanding): > > def and(x, y): > if bool(x) == True: >return y > return x > > Diez > -- > http://mail.python.org/mailman/listinfo/python-list > > -- View this message in context: http://www.nabble.com/Boolean-confusion-tf3715438.html#a10393705 Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list

Re: Boolean confusion

2007-05-09 Thread Antoon Pardon
On 2007-05-09, Greg Corradini <[EMAIL PROTECTED]> wrote: > > Hello all, > I'm having trouble understanding why the following code evaluates as it > does: > string.find('020914A','.') and len('020914A') > 10 > True len('020914A') > 10 and string.find('020914A','.') > -1 > >

Re: Boolean confusion

2007-05-09 Thread Diez B. Roggisch
Greg Corradini wrote: > > Hello all, > I'm having trouble understanding why the following code evaluates as it > does: > string.find('020914A','.') and len('020914A') > 10 > True len('020914A') > 10 and string.find('020914A','.') > -1 > > In the 2.4 Python Reference Ma

Boolean confusion

2007-05-09 Thread Greg Corradini
d." Based on what is said above, shouldn't my first expression ( string.find('020914A','.') and len('020914A') > 10) evaluate to false b/c my 'x' is false? And shouldn't the second expression evaluate to True? Thanks for your help Gr