modernize icon indicating copy to clipboard operation
modernize copied to clipboard

Invalid syntax for if expression

Open jugmac00 opened this issue 6 years ago • 0 comments

I ran python-modernize on a legacy code base and it turned result = filter(lambda item: True if item.get_license_number_minor() == self.get_license_number_minor() else False, license_list) into result = [item for item in license_list if True if item.get_license_number_minor() == self.get_license_number_minor() else False] which the Python interpreter won't execute: SyntaxError: invalid syntax

So, there are missing brackets around the if expression.

P.S.: Yes, the original code is strange, but it worked. Meanwhile i simplified the code and then python-modernize worked.

jugmac00 avatar Aug 07 '19 16:08 jugmac00