[Tutor] What is the difference between checking false?

Joel Goldstick joel.goldstick at gmail.com
Sun Jun 16 04:31:46 CEST 2013


On Sat, Jun 15, 2013 at 10:21 PM, Jim Mooney <cybervigilante at gmail.com>wrote:

> On 15 June 2013 19:03, Dave Angel <davea at davea.name> wrote:
> > Why such a convoluted way of expressing yourself?
>
> I was demonstrating the parallelism, but let's just take one so I can
> unbefuddle meself ;')
>
> *** Python 3.3.2 32 bit (Intel)] on win32. ***
> >>> '' == False
>

== compares two values to see if they are identical.

There are various values that are defined as evaluating to True or False,
using what python people call Duck Typing.  Just because something 'acts'
False like or True like doesn't mean that it is identical to the boolean
value True or the boolean false


In your first example you are checking equality.

Maybe look up python duck typing

> False
> >>> not ''
> True
> >>>
>
> Why the difference here?
>
> --
> Jim
> After indictment the bacon smuggler was put on the no-fry list
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130615/526d0322/attachment.html>


More information about the Tutor mailing list