by defining the __new__() method of the class after the payload
__new__()
Incidentally, you could also just redefine existing methods, which was how I planned to do it. Like,
class Foo(): def __init__(self): self.x = 1 def __init__(self): self.x = 2 Foo().x # 2
Good to know. I’m a C++ guy which has a “one definition rule” not only for the translation unit, but for the whole program, so I incorrectly assumed that python is the same even though the languages are obviously very different.
Incidentally, you could also just redefine existing methods, which was how I planned to do it. Like,
Good to know. I’m a C++ guy which has a “one definition rule” not only for the translation unit, but for the whole program, so I incorrectly assumed that python is the same even though the languages are obviously very different.