diff options
author | Ilya Etingof <etingof@gmail.com> | 2017-03-01 00:15:11 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2017-03-01 00:15:11 +0100 |
commit | 3636cfab0407307cd8707af106776cc954499db4 (patch) | |
tree | 9a71ec68fae2edc061d744b2ade58446f61c0df9 /pyasn1/type/base.py | |
parent | dcc572b74f09a05ab2f34cf573ce19a53c65e630 (diff) | |
download | pyasn1-3636cfab0407307cd8707af106776cc954499db4.tar.gz |
reduce the number of bool() calls
Diffstat (limited to 'pyasn1/type/base.py')
-rw-r--r-- | pyasn1/type/base.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pyasn1/type/base.py b/pyasn1/type/base.py index 9b82662..f65db7e 100644 --- a/pyasn1/type/base.py +++ b/pyasn1/type/base.py @@ -210,10 +210,10 @@ class AbstractSimpleAsn1Item(Asn1ItemBase): if sys.version_info[0] <= 2: def __nonzero__(self): - return bool(self._value) + return self._value and True or False else: def __bool__(self): - return bool(self._value) + return self._value and True or False def __hash__(self): if self.__hashedValue is None: @@ -459,10 +459,10 @@ class AbstractConstructedAsn1Item(Asn1ItemBase): if sys.version_info[0] <= 2: def __nonzero__(self): - return bool(self._componentValues) + return self._componentValues and True or False else: def __bool__(self): - return bool(self._componentValues) + return self._componentValues and True or False def getComponentTagMap(self): raise error.PyAsn1Error('Method not implemented') |