[Tutor] Boolean operations
vince spicer
vinces1979 at gmail.com
Wed Sep 2 16:09:37 CEST 2009
On Wed, Sep 2, 2009 at 4:30 AM, Anthony Casey <AMCasey at xtra.co.nz> wrote:
> Hello, tutors.
>
> I'm someone who used to programme as a hobby and who is trying to get back
> into it via Python. I'm reading Programming in Python 3 by Summerfield
> (excellent book).
>
> I read something unusual about Boolean operations in Python:
>
> >>> five = 5
> >>> two = 2
> >>> zero = 0
> >>> five and two
> 2
>
> I understand what it's doing here: returning the operand. But what is the
> practical application of that? How might I use that function?
> (Short-sighted
> imagination, I realise.)
>
> (I know how binary Booleans work etc., so this is a bit of a change of
> outlook.)
>
> Please pardon me if this is a silly or inane question.
>
> Regards,
> Anthony
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
this might make the "and" operator a little clearer
http://pyref.infogami.com/and
Vince
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090902/341ad09e/attachment.htm>
More information about the Tutor
mailing list