79717709

Date: 2025-07-28 17:56:12
Score: 1
Natty:
Report link
class A:
    def __init__(self, x):
        print("Calling __init__")
        self.x = x

def mynew(cls, *args, **kwargs):
    print("Calling mynew")
    return object.__new__(cls)

A.__new__ = mynew
A(10) 

A.__new__ = lambda cls, x: object.__new__(cls)
a = A(10)  
print(a.x)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Mokhtar omar