On 16/06/13 12:31, Joel Goldstick wrote:
On Sat, Jun 15, 2013 at 10:21 PM, Jim Mooney <cybervigila...@gmail.com>wrote:

On 15 June 2013 19:03, Dave Angel <da...@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.


In Python, objects are considered "identical" if and only if they are the same 
object, not just the same value. == tests two objects to see if they have equal values, 
while the `is` operator tests to see if they are identical (that is, if they are actually 
the same object).


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


True and False are guaranteed to be "singletons" (even though there are two of 
them), that is, there is only one True object and only one False object.

However, any number with the value 1 will compare equal to True, and any number 
with the value of 0 will compare equal to False.

Finally, any object that is considered to be "something" or non-empty should be treated 
as if it were true in a boolean context (e.g. `if obj`, or `while obj`); any object that is 
considered "nothing" or empty should likewise be considered as if it were false.



--
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to