[MERGE] remove has_key() usage

John Arbash Meinel john at arbash-meinel.com
Tue Sep 5 15:46:33 BST 2006

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 '=='.

(Partially, because objects will use __eq__ which can evaluate True for
None, though most would be stupid to do so, and we really want to just
say 'is None').

So you specific comment about the method that doesn't do anything...
That, I believe, was actually only used in ScratchBranch, which we
removed a long time ago. However, +1 to the deprecation, and cleaning up
the __del__ function.

So if you change '==' to 'is' and '!=' to 'is not', you have my +1.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060905/f36f0daa/attachment.pgp 

More information about the bazaar mailing list