Skip to content

Operations on None should fall back to object #1766

Closed

Description

@rwbarton
rwbarton@morphism:~/mypy$ python3 -m mypy --strict-optional -c 'None == None'
<string>:1: error: Unsupported left operand type for == (None)
rwbarton@morphism:~/mypy$ python3 -m mypy --strict-optional -c 'str(None)'
<string>:1: error: No overload variant of "str" matches argument types [builtins.None]

These should not be errors, as the type of None is a subtype of object.

Activity

  1. changed the title [-]Operations on `None` should fall back to `object`[/-] [+]`None` should be a subtype of `object`[/+] on Jun 30, 2016
  2. added this to the milestone on Jul 7, 2016
  3. ddfisher commented on Jul 8, 2016

    @ddfisher
    Collaborator

    Interestingly, this first of these errors isn't just a strict optional problem!

    $ python3 -m mypy -c 'None == None'
    <string>:1: error: Unsupported left operand type for == (None)
    
  4. changed the title [-]`None` should be a subtype of `object`[/-] [+]Operations on `None` should fall back to `object`[/+] on Jul 8, 2016
  5. ddfisher commented on Jul 8, 2016

    @ddfisher
    Collaborator

    My renaming of this was incorrect -- currently None is a subtype of object, but object isn't in None's MRO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions