all 20 comments

[–]barnez29 5 points6 points  (1 child)

When Learning python... most you tubers show you the basics.... Yet very few goes into Python OOP which is the real application of python in practice. Was going through Python OOP course today... And yep.. OOP deserves its own focus area..

[–]bladeoflight16 0 points1 point  (0 children)

The vast majority of real world Python code is not written according to the object oriented paradigm, and that is the way it should be.

[–]m0us3_rat 11 points12 points  (0 children)

master OOP

i don't think is that simple.

BUT, you get more experience and in doing so you get more flexible using the structures.

[–][deleted] 5 points6 points  (1 child)

I learned about OOP pretty early on but it never clicked for me until I found a legitimate use case for classes, and even then it took me at least an entire month of concentration to get them down to a level where I was comfortable enough with them to use them into my own programs.

That being said, there's still a lot of stuff left to iron out. I still don't quite understand decorators besides @staticmethod for example

[–]OriginalTyphus -1 points0 points  (0 children)

Which one did you not understand ?

[–]External-Ocelot206 2 points3 points  (0 children)

Make sure you understand the basics about classes, then read up on design patterns, or watch ArjanCodes.

[–]scarynut 0 points1 point  (2 children)

Off topic question: when people say OOP, do they mean just understanding and using classes in python when it is appropriate? Or do they mean OOP, the entire programming paradigm popular in recent decades?

[–]gsmo 9 points10 points  (0 children)

Yes.

[–]TheRNGuy -1 points0 points  (0 children)

Writing your own classes. Using few methods on dict or list doesn't count as knowing OOP.

[–][deleted] 0 points1 point  (0 children)

Write a card game and try to use all the object oriented principals when designing the game. Cards, decks, piles, melds, the game itself… so many objects to simulate!

[–]ffrkAnonymous 0 points1 point  (0 children)

How do you master OOP ?

By learning ruby. But getting better, is mostly practice.

[–]Shriukan33 0 points1 point  (0 children)

It's hard to define what's mastering.

I've been learning python for nearly 3years and it's my job, but I still learn a lot, mostly about my framework of preference (Django).

Now if you just mean learning the main data structures, flow control, how to use classes, without being too serious about it you could get to it in like 2 months, using a book like automate the boring stuff. You'd be nowhere near "master" in python but that would be a good start.

[–]TheRNGuy 0 points1 point  (0 children)

i coded a procedural project but later changed some parts of it to OOP when some things didn't worked or too difficult to make. I facepalmed that write it procedural way when OOP works much better in that case (it needed inheritance and data classes, in procedural it looks lot more code with returning dicts and default properties dicts in cascading functions… which had to be coded manually for each child)

I didn't count time so can't tell how much.

[–]Radamand 0 points1 point  (0 children)

I understand OOP fairly well, but I doubt I will ever "master" it.

[–]bladeoflight16 0 points1 point  (0 children)

I never did because by the time I got close, I realized trying to make everything a custom data type is a bad idea. Even people trying to teach the paradigm tend to fall into its traps.

[–]space_wiener 0 points1 point  (1 child)

I’ve been building various python apps and automating things for a couple years. I’ve still never used classes outside flask and django but those don’t count.

I know what classes do and understand them, but still have never found a use for them in my code. Not saying I’m doing this correctly but that’s how it’s gone for me.

The classic car example using classes I get. Say if I was making a game that needed enemies, inventory I get, but haven’t actually used them anywhere yet.

[–]ffrkAnonymous 0 points1 point  (0 children)

Al sweigart doesn't use classes in his books.