On Sun, 27 Nov 2011 02:42:52 +0100, candide wrote:
>> Even if you can guarantee that your code base does not contain any
>> object which compares equal to None except for None itself (and how
>> would you do that? a full audit of every line of code in every library
>> you use?), the use of `is` sh
On Sun, Nov 27, 2011 at 12:42 PM, candide wrote:
> So, for the same reason, wouldn't it be better to use "if spam is True"
> against to "if spam == True" (or better "if spam") ?
>
They're quite different. "if spam" will check the truthiness of spam -
it's equivalent to "if bool(spam) is True"; "
Thanks to all for your response.
Le 27/11/2011 00:01, Steven D'Aprano a écrit :
On Sat, 26 Nov 2011 22:20:36 +0100, candide wrote:
In which cases should we use the is() function ? The is() function
compares identity of objects rather than values so I was wondering in
which circumstances compa