Perl and Python, a practical side-by-side example.

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Mar 3 03:10:14 EST 2007


In <54sl5dF21mn73U1 at mid.individual.net>, Bjoern Schliessmann wrote:

> Bruno Desthuilliers wrote:
>> Shawn Milo a écrit :
> 
>>>     if recs.has_key(piid) is False:
>> 
>> 'is' is the identity operator - practically, in CPython, it
>> compares memory addresses. You *dont* want to use it here.
> 
> It's recommended to use "is None"; why not "is False"? Are there
> multiple False instances or is False generated somehow?

Before `True` and `False` existed many people defined them as aliases to 1
and 0.  And of course there are *many* other objects that can be used in a
boolean context of an ``if`` statement for testing "trueness" and
"falseness".

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list