mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Performance improvement using in-operator for hash lookups
Just a small cleanup for the existing occurrences. Using the in-operator for hash lookups is faster than using .has_key() http://stackoverflow.com/questions/1323410/has-key-or-in
This commit is contained in:
@@ -163,7 +163,7 @@ class Rhn(RegistrationBase):
|
||||
def get_option_default(self, key, default=''):
|
||||
# ignore pep8 W601 errors for this line
|
||||
# setting this to use 'in' does not work in the rhn library
|
||||
if self.has_key(key):
|
||||
if key in self:
|
||||
return self[key]
|
||||
else:
|
||||
return default
|
||||
|
||||
Reference in New Issue
Block a user