Skip to content

==/!= doesn't work on optional type #1824

Closed
@gvanrossum

Description

@gvanrossum

Behold:

def f(a: Optional[str], b: Optional[str]) -> bool:
  return a == b

We get this beautiful error with --strict-optional:

error: Unsupported left operand type for == (some union)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions