Skip to content

Conversation

@BarbossHack
Copy link

@BarbossHack BarbossHack commented Jan 31, 2026

First time contributor checklist

Contributor checklist

  • Desktop, Linux (feodra 42)
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

Enforce strict type comparison.

Example of a bad type comparison with '==':

class Meta(type):
    def __eq__(cls, other):
        return True
class A(metaclass=Meta):
    pass
class B(metaclass=Meta):
    pass

a = A()
b = B()
print(type(a) == type(b))  # True  - because Meta.__eq__ returns True
print(type(a) is type(b))  # False - type check is correct

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

Successfully merging this pull request may close these issues.

1 participant