# re.finditer get confused if it receives a LazyRegex
if getattr(re, 'finditer', None is not None): ^^^^^^^^^^^^
Surely the comparison should be outside the function call:
if getattr(re, 'finditer', None) is not None: ^^^^^^^^^^^
In practice this has the same effect: 'None is not None' => 'False' so getattr() returns False if the attr is not found, and something truthy if the attr is found. You could even omit it:
From the patch <http:// bazaar. launchpad. net/~bzr- pqm/bzr/ 2.7/revision/ 6621>:
# re.finditer get confused if it receives a LazyRegex
^^^^ ^^^^^^^ ^
if getattr(re, 'finditer', None is not None):
Surely the comparison should be outside the function call:
if getattr(re, 'finditer', None) is not None:
^^ ^^^^^^^ ^^
In practice this has the same effect: 'None is not None' => 'False' so getattr() returns False if the attr is not found, and something truthy if the attr is found. You could even omit it:
if getattr(re, 'finditer', None):