[Zope3-checkins] SVN: Zope3/trunk/src/zope/dependencytool/dependency.py isSubPackageOf(): simplify the implementation

Fred L. Drake, Jr. fred at zope.com
Wed May 19 17:41:01 EDT 2004


Log message for revision 24835:
isSubPackageOf(): simplify the implementation


-=-
Modified: Zope3/trunk/src/zope/dependencytool/dependency.py
===================================================================
--- Zope3/trunk/src/zope/dependencytool/dependency.py	2004-05-19 21:39:06 UTC (rev 24834)
+++ Zope3/trunk/src/zope/dependencytool/dependency.py	2004-05-19 21:41:00 UTC (rev 24835)
@@ -41,14 +41,7 @@
 
     def isSubPackageOf(self, dep):
         """Return True if this dependency's path is a sub-package of dep."""
-        path = self.path.split('.')
-        deppath = dep.path.split('.')
-        for i in range(len(path)):
-            if i >= len(deppath):
-                return True
-            if path[i] != deppath[i]:
-                break
-        return False
+        return self.path.startswith(dep.path + ".")
 
     def __cmp__(self, other):
         """Compare dependecies by module name."""




More information about the Zope3-Checkins mailing list