News for hackers. Stuff that matters.

jhji7i77l

Re:Frankenstein's `__init__` on Saturday April 19, 2025 @12:59PM (#43737656)
> To be clear, a good init is not supposed to create a thread or do any execution that might not be instant of things like that.

Maybe it indirectly ensures that only one thread is created per instantiation; there are better ways of achieving that though.

Re:Frankenstein's `__init__` on Saturday April 19, 2025 @12:53PM (#43737615)
> Even `Path("config.json").read_text()` in a constructor isn't a good idea.

If that call is necessary to ensure that the instance has a good/known internal state, I absolutely think it belongs in __init__ (whether called directly or indirectly via a method).