Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid syntax for if expression #194

Open
jugmac00 opened this issue Aug 7, 2019 · 0 comments
Open

Invalid syntax for if expression #194

jugmac00 opened this issue Aug 7, 2019 · 0 comments

Comments

@jugmac00
Copy link

jugmac00 commented Aug 7, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant