This product is not supported for your selected Datadog site. ().
Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Data classes (annotated with @dataclass) do not use special methods, such as __init__, __gt__, and others.
Non-Compliant Code Examples
@dataclassclass_Leaf(Generic[T]):parent:_Leafvalue:Tdef__init__(self,value:Optional[T]=None):self.value=valueself.parent=selfdefupdate(self,value:T):self.value=valuereturnselfdef__lt__(self,other:_Leaf):returnrepr(self)<repr(other)def__gt__(self,other:_Leaf):returnrepr(self)>repr(other)# __eq__ should not be useddef__eq__(self,other:_Leaf):returnrepr(self)==repr(other)def__repr__(self):returnself.value