Skip to content
CodeKruPro

== on plain objects and on a dataclass

Predict the outputMedium-HardPython only
main.py
from dataclasses import dataclass

class PlainPoint:
    def __init__(self, x):
        self.x = x

@dataclass
class DataPoint:
    x: int

print(PlainPoint(1) == PlainPoint(1))
print(DataPoint(1) == DataPoint(1))
print(DataPoint(1) in [DataPoint(1)])
print(DataPoint(1))

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in