Descripción
Create a class with __repr__ and __eq__ special methods
File Template: ❌
Prefix
class:special
Scopes
python
Snippet de código
class ${1:MyClass}:
def __init__(self, ${2:attr}):
self.$2 = $2
def __repr__(self):
return f"$1($2={self.$2})"
def __eq__(self, other):
if isinstance(other, $1):
return self.$2 == other.$2
return False