You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's really a good tutorial to start with. After learning some of the basics of Python, however, classes seem to be a quite sophisticated topic. Do you think it would be better to add more conceptual stuff built on classes, like inheritance or polymorphism, etc?
The text was updated successfully, but these errors were encountered:
We could add more OOP stuff, but before doing that, we should explain when classes are used. Currently the tutorial does a good job explaining how classes work, but not so much when to use them. IMO you should use:
a plain old class when you end up with many functions that all access the same data
a dataclass when you just want to group together related data (similar to struct in other languages)
fancy OOP things (inheritance etc) only in some rare cases.
Many people overuse fancy OOP things, and are too arfaid to break OOP's "rules" when it makes sense. Most of the time it's best to use a plain old simple class. That said, sometimes inheritance is the right tool for the job, and programmers should know it.
Yep, yep, really class is a quite complicated topic for me compared to those basic things in Python, and sometimes I just can't find a practical way to apply the OOP concepts to my case, and I can only handle a simple old class which seems pretty lame. We really need to make a good structure of these concepts and explain the possible use cases.
That's really a good tutorial to start with. After learning some of the basics of Python, however, classes seem to be a quite sophisticated topic. Do you think it would be better to add more conceptual stuff built on classes, like inheritance or polymorphism, etc?
The text was updated successfully, but these errors were encountered: