Re: Python "and" behavior

2009-08-14 Thread Ethan Furman
MRAB wrote: Gary Herron wrote: goldtech wrote: Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. ss=1 and "f" ss 'f' ss=0 and "f" ss 0 Python's Boole

Re: Python "and" behavior

2009-08-14 Thread Duncan Booth
MRAB wrote: > Operation Result >|x or y| x if x else y >|x and y| y if x else x >|not x| False if x else False > >:-) > That's not a terribly good definition for the 'not' operator. Try: |not x| False if x else True -- Duncan Booth http://kupuguy.blogspot.com -- htt

Re: Python "and" behavior

2009-08-14 Thread ryles
On Aug 13, 8:36 pm, goldtech wrote: > Could you explain or link me to an explanation of this? http://docs.python.org/tutorial/datastructures.html#more-on-conditions Give the whole tutorial a good read. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "and" behavior

2009-08-13 Thread MRAB
Gary Herron wrote: goldtech wrote: Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. ss=1 and "f" ss 'f' ss=0 and "f" ss 0 Python's Boolean operators don't

Re: Python "and" behavior

2009-08-13 Thread Stephen Hansen
> > Could you explain or link me to an explanation of this? Been using > Python for a while but not sure I understand what's happening below. > Thanks. > > >>> ss=1 and "f" > >>> ss > 'f' > >>> ss=0 and "f" > >>> ss > 0 > >>> The "and" and "or" operators in Python are actually not tru

Re: Python "and" behavior

2009-08-13 Thread Mensanator
On Aug 13, 7:36 pm, goldtech wrote: > Could you explain or link me to an explanation of this? Been using > Python for a while but not sure I understand what's happening below. > Thanks. > > > > > > >>> ss=1 and "f" > >>> ss > 'f' > >>> ss=0 and "f" > >>> ss > 0 Does this help? >>> s

Re: Python "and" behavior

2009-08-13 Thread Gary Herron
goldtech wrote: Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. ss=1 and "f" ss 'f' ss=0 and "f" ss 0 Python's Boolean operators don't turn arbitrary valu

Python "and" behavior

2009-08-13 Thread goldtech
Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. >>> ss=1 and "f" >>> ss 'f' >>> ss=0 and "f" >>> ss 0 >>> -- http://mail.python.org/mailman/listinfo/python-list