Skip to content

Invalid syntax for if expression #194

Open
@jugmac00

Description

@jugmac00

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions