r/Python • • Mar 07 '26

Discussion Why does __init__ run on instantiation not initialization?

Why isn't the __init__ method called __inst__? It's called when the object it instantiated, not when it's initialized. This is annoying me more than it should. Am I just completely wrong about this, is there some weird backwards compatibility obligation to a mistake, or is it something else?

0 Upvotes

14 comments sorted by

View all comments

Show parent comment

6

u/AlternativePaint6 Mar 07 '26

Or just don't use singleton pattern in Python. Every module is already a singleton, just place the variables and functions at module level.

0

u/commy2 Mar 07 '26

Generally yes, but I had singletons in the past that shouldn't be initialized at import time.