diff hgext/bookmarks.py @ 8527:f9a80054dd3c

use 'x is None' instead of 'x == None' The built-in None object is a singleton and it is therefore safe to compare memory addresses with is. It is also faster, how much depends on the object being compared. For a simple type like str I get: | s = "foo" | s = None ----------+-----------+---------- s == None | 0.25 usec | 0.21 usec s is None | 0.17 usec | 0.17 usec
author Martin Geisler <mg@lazybytes.net>
date Wed, 20 May 2009 00:52:46 +0200
parents 46293a0c7e9f
children 353b1c160c2d
line wrap: on
line diff
--- a/hgext/bookmarks.py	Wed May 20 00:43:23 2009 +0200
+++ b/hgext/bookmarks.py	Wed May 20 00:52:46 2009 +0200
@@ -143,7 +143,7 @@
         return
 
     if delete:
-        if mark == None:
+        if mark is None:
             raise util.Abort(_("bookmark name required"))
         if mark not in marks:
             raise util.Abort(_("a bookmark of this name does not exist"))
@@ -171,7 +171,7 @@
         write(repo, marks)
         return
 
-    if mark == None:
+    if mark is None:
         if rev:
             raise util.Abort(_("bookmark name required"))
         if len(marks) == 0:
@@ -243,7 +243,7 @@
             """Add a revision to the repository and
             move the bookmark"""
             node  = super(bookmark_repo, self).commit(*k, **kw)
-            if node == None:
+            if node is None:
                 return None
             parents = repo.changelog.parents(node)
             if parents[1] == nullid: