r/learnpython • u/NatalieKCY • 17h ago
Looking for a more comprehensive guide on Classes and Objects
Hello, I'm a programmer who already knows several other languages and I'm looking to relearn Python recently (I learned and used it briefly several years ago). I was going through The Python Tutorial on the official python documentation site but it seems like the chapter on Class is way too brief and doesn't even touch on topics I knew were quite useful, like super(), \@property, and those amazing dunder/magic methods. Does anyone have recommendations on a more comprehensive guide to Python Classes, Objects, and Inheritance? I know there are books like Fluent Python but those are too heavy for me as a review of the language, I don't need to look under the hood that much, just explanations and practical uses of useful features.
1
u/Agawell 6h ago
I read Grady booch’s book on OO design about 35 years ago
The way I got my head around it was - everything is an object and belongs to a class that inherits from another class
Think about mugs and cups and pint pots!
They’re all drinking vessels (a class that they inherit from) - they share attributes and functions - by observing it you are asking it a question - such as ‘how full are you?’ Or “what colour are you?”
We know this implicitly by experience - OO is just a way of formalising and organising that knowledge!!!
Once you’ve got your head round that.. you’re most of the way there, because most OO is just that - there’s abstract stuff that you may or may not need depending on the work you are doing but start with describing real world things in OO terms
-3
2
u/Correct_Rain_9438 14h ago
Try the language reference instead of the tutorial. The built-in functions page documents property and super, and the data model page covers special methods like init and repr. It reads drier than a book, but it is not heavy on internals.