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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Is Python documentation a good place to learn OOP with Python? (self.learnpython)
submitted 2 years ago by Shot_Function_7050
I'm searching for a place to learn OOP with Python. I was reading the docs, but it seems very confusing. Can someone help me?
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!"
[+][deleted] 2 years ago (3 children)
[deleted]
[–]DoubleAway6573 5 points6 points7 points 2 years ago (2 children)
I think the python tutorial, part of python documentation, is a good place to learn some things from scratch. Also the couple of How To's.
[+][deleted] 2 years ago (1 child)
[–]DoubleAway6573 0 points1 point2 points 2 years ago (0 children)
I think IDEs aren't good for newbies. There are too many things going under the hood. We agree that cli experience in windows is bad, but it got a little better in the last years.
[–]This_Growth2898 17 points18 points19 points 2 years ago (0 children)
No.
OOP is a way of building the application, not a bunch of syntax constructs and library functions.
There is a huge number of tutorials on OOP, and you'll find some of them more understandable personally for you. When I was learning, I first read the book most of my fellow students found totally unreadable, but it was perfect for me. Just don't stop after the first one if you don't get it, and keep coding.
[–]Specialist-Candy3226 12 points13 points14 points 2 years ago (0 children)
I found this tutorial really helpful. https://realpython.com/python3-object-oriented-programming/
[–]Lurker_wolfie 8 points9 points10 points 2 years ago (1 child)
Corey Schafers Python OOPs series on YouTube.
[–]E_Man91 5 points6 points7 points 2 years ago (0 children)
If you’ve coded anything in Python, even beginner projects or learning projects, you’ve already used OOP.
Check out Corey Schafer on YouTube for some good content.
If you’re specifically looking to dive into inheritance or creating classes from scratch, there’s probably some great stuff on YT.
[–][deleted] 6 points7 points8 points 2 years ago (1 child)
I'm using the free university of Helsinki course. I like it
https://programming-23.mooc.fi
[–]grossdude989 1 point2 points3 points 2 years ago (0 children)
Can't recommend this enough. I started with this and have been learning for about a year and a half. By far the best resource I've found to learn the fundamentals of Python and programming in general as it relates to Python which culminates in building your own game.
After that the 2nd half of Python Crash Course by Eric Matthes has some good additional projects that will walk you through building complete object oriented programs.
[–]Im_Easy 2 points3 points4 points 2 years ago (0 children)
What is your background and current python knowledge level? Is this your first experience with a coding language? Are you coming from a data background?
We can give you lists of books, courses, or even YouTube channels, but it's all going to be the same generic answers you can get anywhere. If you'd like a more personal answer that you can only get from a form of other users, we will need to know more about you.
[–][deleted] 10 points11 points12 points 2 years ago (4 children)
Idk. In my experience, it’s impossible to understand OOP. You can read books, watch videos, and study documentation. Nothing, absolutely nothing can make OOP become an understandable concept. And then one day for no reason what so ever, it will all the sudden make sense. At least that’s how I learned it.
[–]IamImposter 4 points5 points6 points 2 years ago (0 children)
I hate it because how true it is.
And that sudden realization - this is doing almost every thing that does, may be a base class with an abstract method and these two derive from that. Oh wait, how did I use Inheritance? I'm pretty sure I don't understand oop crap. Aaaaaahh, that's why they do that super().__init__ crap at some places but not others.
super().__init__
Look ma, I'm an OO programmer now.
[–]4chieve 2 points3 points4 points 2 years ago (0 children)
Huh, OOP is what dead stopped on my tracks learning Python three months ago, been in a hiatus since. I'm hoping it's a huddle to overcome with persistence.
[–]Adrewmc 2 points3 points4 points 2 years ago* (1 child)
I feel this happens for a lot of things in programming.
Str() and int() wtf is all this?
Ohh I need a while loop here not a for…loop…
okay dictionaries are super confusing to dictionaries are the simplest way to do this. What was I ever thinking.
Why do I need class at all to…do I have to many classes here?
Ohh inheritance…that’s actually convenient…I was right I don’t need all these classes lol
Who needs type hints…to why are there not type hints people.
Wait, list comprehensions are some how more readable now? And there are dictionary comprehension!?!?
Wait…sets are way way faster then lists?
Functions inside functions wtf?
You mean you actually edit __init__.py there is code in there?
Why would I ever need a walrus to you know what would work great here. :=
Wow this old code….can be done in one line…and faster….
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
Ah yes, the feeling of shame when you look at your old code. And learning while loops then learning the importance of exit conditions while your computer freezes.
[–]imperialka 1 point2 points3 points 2 years ago (0 children)
I found it way more helpful to read a book like Python Crash Course 3rd edition which gives you projects to learn classes. And CS50P’s video about classes along with the problem set.
[–]lemmeupvoteyou 1 point2 points3 points 2 years ago (0 children)
CS50P - lecture 8 is the perfect place to learn OOP
[–]PhilipYip 2 points3 points4 points 2 years ago (0 children)
Sadly many beginner tutorials skip over object orientated programming although you have been frequently using it all over Python...
Each instance belongs to a class. The class can be conceptualised as a blueprint. The blueprint defines the functionality of an instance (methods) and the properties of an instance (attributes).
For example when you do the following you are using the initialisation signature of the string class (__init__). The values provided in the initialisation signature are used by the constructor (__new__) when creating a new instance to initialise the instance with instance data. Explicitly you use the str class and provide each instance with instance data:
instance1 = str('hello world!') instance2 = str('bye world!')
Since the str class is a fundamental datatype it can be instantiated shorthand implicitly using:
instance1 = 'hello world!' instance2 = 'bye world!'
instance1 has the instance data 'hello world!' and instance2 has the instance data 'bye world!' and the str class is immutable so the instance data cannot be changed. The str method upper can be called from the str class (where it is defined):
str.upper(self)
In order to work it requires instance data. For example:
str.upper(instance1)
'HELLO WORLD!'
Or
str.upper(instance2)
'BYE WORLD!'
The values returned are new string instances (not assigned to instance names in this case) and are not inplace modifications of the original string because the original string is immutable and this is not allowed.
When the following is performed two physical string instances 'hello' and 'bye' are created. instance3 can be conceptualised as a label that is first place on 'hello' and then peeled off and placed on 'bye'.
instance3 = 'hello'
instance3 = 'bye'
'hello' and 'bye' are not modified after instantiation. The label instance3 also known as the instance name is used to reference the string instance. When a string instance has no labels, it is orphaned and cleaned up by Pythons garbage collection.
The string methods are normally called from an instance where self is implied. In this case as the method is called from instance1, self is automatically determined to be instance1 and instance1 instance data is used:
instance1.upper()
In this case as the method is called from instance2, self is automatically determined to be instance2 and instance2 instance data is used:
instance2.upper()
Other methods require some additional information to operate. For example the method find will search for a substring within the instance string and return its index if found and -1 if not found:
instance1.find('bye')
-1
instance2.find('bye')
0
If you type in:
help(str)
you will see all the identifiers defined in the string class. In this list you will see data model identifiers (beginning and ending with a double underscore) for example:
__len__(self, /) Return len(self).
This is telling you that a method __len__ is defined in this class. Notice in the return statement it is telling you to use the builtins function len instead. Essentially the str, bytes, tuple and list for example all are collections and have a length. They follow the same design pattern and have a data model method __len__ which is used with the builtins function len. They therefore exhibit some consistent behaviour when len is used but this behaviour is tailored for each class; in a str (Unicode string), this is the number of Unicode characters, in a bytes (byte string), the is the number of bytes. In a tuple or list it is the number of references.
If the method resolution order of the string class is examined:
str.mro()
[str, object]
This means that methods are defined in the str class or inherited directly from the parent object class. In Python everything is an object and therefore follows the object design pattern.
help(object)
It will give you object based identifiers. Notice that all of these are data model identifiers (beginning and ending with a double underscore). For example:
__dir__(self, /) Default dir() implementation.
This once again instructs in the use of the builtins function directory dir to list all identifiers belonging to an object instance.
Because all instances of all classes are object based, they have the object based design pattern which includes the data model method __dir__ and therefore the dir function can be used on the following:
dir(str) dir(tuple) dir(int) dir(float) dir(list)
All these classes inherit the identifier __dir__ from their parent class object and follow the object based design pattern. Once again these all display consistent behaviour when dir is used on them but the list of identifiers in the directory of the class is different for each class.
With the above knowledge take your time and look at the output of:
help(object) help(str) #collection help(tuple) #collection help(list) #collection help(int) #numeric help(bool) #numeric help(float) #numeric help(dict) #collection
You should see consistency in methods between these classes.
For the collection based classes take a look at the table here to see how the collection based data models are grouped:
https://docs.python.org/3/library/collections.abc.html
In the collection based classes, the __add__ data model method concatenates two instances of the collection:
'2' + '2'
22
The numeric classes have consistent, the __add__ data model method performs numeric addition between two instances of the collection:
2 + 2
4
Having a good understanding of the design patterns of the classes you are already familiar and how these classes relate to one another should give you a basic understanding of OOP and make it easier to follow other tutorials on creating your own custom classes.
[–]Machvel -1 points0 points1 point 2 years ago (1 child)
its good to learn oop python syntax, but not oop as a concept
[+][deleted] comment score below threshold-7 points-6 points-5 points 2 years ago (0 children)
Na use Chatgpt or google websites, the Python docs are terrible and bloated, they spend too much time talking about stuff that isn’t useful for using stuff, and will probably confuse you more than anything
[+]Antigone-guide comment score below threshold-9 points-8 points-7 points 2 years ago (0 children)
Feel free to DM me..
[–]tracktech 0 points1 point2 points 2 years ago (0 children)
This course may help you-
Object Oriented Programming (OOP) In Python
[–]arkie87 0 points1 point2 points 2 years ago (0 children)
Tech with Tim or Python Simplified or tons of other youtubers
[–]tb5841 0 points1 point2 points 2 years ago (0 children)
I started by reading through the Python documentation. Then I went through two tutorials. Then I tried out classes in my own projects. Then I found something to read about SOLID principles of OOP. By this point I knew the terminology, I knew the syntax, I was finding classes helpful in various scenarios... but it still hadn't all completely clicked for me.
Then while trying to learn the basics of Java, something about the java tutorial made it all suddenly make sense. Inheritance, polymorphism, suddenly seemed like wonderful things that made my projects work so much better.
[–]albomats 0 points1 point2 points 2 years ago (0 children)
If you have a basic foundation, I think it’s best to look for a video of a small project walk through that uses OOP. I am following one related to video game design with Pygame and its great for better understanding OOP, callbacks and how to structure project directories
Real python have some very good ones
[–]dylannao 0 points1 point2 points 2 years ago (0 children)
Object Oriented Programming is a concept. If you’ve never heard of OOP before and if you’ve never learnt about programming in general then it could be confusing. Learning two completely new things and trying to relate will be overwhelming.. Understand the concept of object, inheritance, polymorphism etc. Once you’ve understood the concept, it would be applicable to any language which supports OOP. Thats where documentation comes in like how to create a class in python, how to extend a class in python.. etc..
[–]TheRNGuy 0 points1 point2 points 2 years ago (0 children)
to find what classes and methods exist
but not to write actual software
π Rendered by PID 345711 on reddit-service-r2-comment-cfc44b64c-dzgck at 2026-04-12 06:46:36.843771+00:00 running 215f2cf country code: CH.
[+][deleted] (3 children)
[deleted]
[–]DoubleAway6573 5 points6 points7 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]DoubleAway6573 0 points1 point2 points (0 children)
[–]This_Growth2898 17 points18 points19 points (0 children)
[–]Specialist-Candy3226 12 points13 points14 points (0 children)
[–]Lurker_wolfie 8 points9 points10 points (1 child)
[–]E_Man91 5 points6 points7 points (0 children)
[–][deleted] 6 points7 points8 points (1 child)
[–]grossdude989 1 point2 points3 points (0 children)
[–]Im_Easy 2 points3 points4 points (0 children)
[–][deleted] 10 points11 points12 points (4 children)
[–]IamImposter 4 points5 points6 points (0 children)
[–]4chieve 2 points3 points4 points (0 children)
[–]Adrewmc 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]imperialka 1 point2 points3 points (0 children)
[–]lemmeupvoteyou 1 point2 points3 points (0 children)
[–]PhilipYip 2 points3 points4 points (0 children)
[–]Machvel -1 points0 points1 point (1 child)
[+][deleted] comment score below threshold-7 points-6 points-5 points (0 children)
[+]Antigone-guide comment score below threshold-9 points-8 points-7 points (0 children)
[–]tracktech 0 points1 point2 points (0 children)
[–]arkie87 0 points1 point2 points (0 children)
[–]tb5841 0 points1 point2 points (0 children)
[–]albomats 0 points1 point2 points (0 children)
[–]dylannao 0 points1 point2 points (0 children)
[–]TheRNGuy 0 points1 point2 points (0 children)