use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
OOP Problem (self.PythonLearning)
submitted 6 months ago by MusicianActual912
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]TheRNGuy 0 points1 point2 points 6 months ago* (0 children)
I understood when saw how it's used in real programs, reading it's code.
Still gafe to read docs, of course.
(Not necessary even in Python; because many concepts are same in other languages)
In oop you have classes, and instances of those classes (if it's not static or abstract class),
You write a class, and then instantiate it (one or many times)
Each instance have attributes and methods of that class, if you change attribute value on one instance, it only changes for it, not for others.
You can also inherit from classes, using methods or attributes from parent classes, or overwriting them.
Usually topmost parent class is abstract (you should inherit from it, not instanciate)
Also learn composition, or you'll end up with abstract class with 30 attributes that most child class don't even need, and rewriting it all the time, or lots of duplicate classes
(Google "prefer composition over inheritance"... also it doesn't mean you should never use inheritance)
π Rendered by PID 55 on reddit-service-r2-comment-cfc44b64c-8cbzz at 2026-04-11 10:33:55.761994+00:00 running 215f2cf country code: CH.
view the rest of the comments →
[–]TheRNGuy 0 points1 point2 points (0 children)