[MERGE] remove has_key() usage
Robey Pointer
robey at lag.net
Fri Sep 8 02:49:59 BST 2006
On 5 Sep 2006, at 7:46, John Arbash Meinel wrote:
> Robey Pointer wrote:
>> My no_has_key branch at:
>>
>> http://www.lag.net/~robey/code/bzr.dev.no_has_key/
>>
>> has removed remaining usage of hasattr(). One of the uses was in a
>> Branch method with a comment that it probably didn't do anything --
>> which turned out to be true. I just removed the useless member
>> and made
>> the deprecation more explicit.
>>
>> robey
>>
>>
>
> The preferred way to compare against None is actually:
>
> if foo is None:
>
> or if foo is not None:
>
> not foo == None / foo != None.
>
> None is a singleton, and "is" is faster than '=='.
Mine too. That's how I've usually done it in the past.
But recently, pychecker started complaining about me using 'is'. It
says:
Using is None, may not always work
So what's that all about? "May not always work"? That sounds pretty
serious. Anyone know?
I've seen that the bzr code often uses "foo == None" so decided to
follow that until I found out more about what's so wrong with "foo is
None".
robey
More information about the bazaar
mailing list