]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
eliminate hardcode sections length
authorBob Halley <halley@play-bow.org>
Fri, 26 Jun 2020 21:38:03 +0000 (14:38 -0700)
committerBob Halley <halley@play-bow.org>
Fri, 26 Jun 2020 21:38:03 +0000 (14:38 -0700)
dns/message.py

index d661464f404279bd8a839ff9da404940f575845c..5aa3f52fabbf31a86ef9fdbc82f60bd89b8ce2ef 100644 (file)
@@ -218,8 +218,7 @@ class Message:
             return False
         if self.flags != other.flags:
             return False
-        for i in range(4):
-            section = self.sections[i]
+        for i, section in enumerate(self.sections):
             other_section = other.sections[i]
             for n in section:
                 if n not in other_section:
@@ -271,8 +270,8 @@ class Message:
         Returns an ``int``.
         """
 
-        for i in range(4):
-            if section is self.sections[i]:
+        for i, our_section in enumerate(self.sections):
+            if section is our_section:
                 return self._section_enum(i)
         raise ValueError('unknown section')