From: Bob Halley Date: Fri, 26 Jun 2020 21:38:03 +0000 (-0700) Subject: eliminate hardcode sections length X-Git-Tag: v2.0.0rc2~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaf0a13778dfd7811e6b21584eaa95c636246e4f;p=thirdparty%2Fdnspython.git eliminate hardcode sections length --- diff --git a/dns/message.py b/dns/message.py index d661464f..5aa3f52f 100644 --- a/dns/message.py +++ b/dns/message.py @@ -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')