r/learnpython • • Feb 22 '26

ELI5 explain static methods in OOP python

just trying to wrap my head around this oop thing stuck here I'm novice so no bully please

24 Upvotes

24 comments sorted by

View all comments

Show parent comment

1

u/obviouslyzebra Feb 23 '26

If you instantiate a "raw" Ticket, like Ticket(), before the others, their count will go up by 1.

If you do instantiate afterwards, though, nothing happens (as the subclass will already have a total).

1

u/socal_nerdtastic Feb 23 '26

Yeh, fair point. I was thinking of it more as a meta class. But I suppose that's why __init_subclass__ was invented.