diff mercurial/archival.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 b87a50b7125c
children c5f36402daad
line wrap: on
line diff
--- a/mercurial/archival.py	Wed May 20 00:43:23 2009 +0200
+++ b/mercurial/archival.py	Wed May 20 00:52:46 2009 +0200
@@ -44,7 +44,7 @@
             timestamp = None
             if 'timestamp' in kw:
                 timestamp = kw.pop('timestamp')
-            if timestamp == None:
+            if timestamp is None:
                 self.timestamp = time.time()
             else:
                 self.timestamp = timestamp