diff mercurial/util.py @ 13200:6f011cf52f9a

avoid .split() in for loops and use tuples instead split can be more readable for longer lists like the list in dirstate.invalidate. As dirstate.invalidate is used in wlock() and therefoe used heavily, I think it's worth avoiding a split there too.
author David Soria Parra <dsp@php.net>
date Thu, 02 Dec 2010 03:43:06 +0100
parents 684a977c2ae0
children 18f0084a97c8
line wrap: on
line diff
--- a/mercurial/util.py	Mon Dec 06 16:56:06 2010 +0100
+++ b/mercurial/util.py	Thu Dec 02 03:43:06 2010 +0100
@@ -1099,7 +1099,7 @@
         if not defaults:
             defaults = {}
         now = makedate()
-        for part in "d mb yY HI M S".split():
+        for part in ("d", "mb", "yY", "HI", "M", "S"):
             if part not in defaults:
                 if part[0] in "HMS":
                     defaults[part] = "00"
@@ -1146,7 +1146,7 @@
 
     def upper(date):
         d = dict(mb="12", HI="23", M="59", S="59")
-        for days in "31 30 29".split():
+        for days in ("31", "30", "29"):
             try:
                 d["d"] = days
                 return parsedate(date, extendeddateformats, d)[0]