r/PythonLearning • • 11d ago

What Python concepts took you the longest to understand as a beginner?

I've been learning Python and noticed that understanding the syntax is often the easy part. The real challenge comes when trying to apply concepts in actual projects.

I'm curious to hear from other Python learners:

  1. Which concept was the hardest for you to understand?

  2. Did you struggle more with OOP, decorators, APIs, async programming, or data structures?

  3. What helped you finally understand it?

  4. If you could give one piece of advice to someone learning Python today, what would it be?

I think sharing these experiences could help beginners avoid some common learning roadblocks.

Looking forward to hearing your experiences!

71 Upvotes

73 comments sorted by

6

u/EbbMother5325 11d ago

I only cared about decorators much later in my career.
I was using them in flask projects etc ofc but more as a “I have to write this thing here because that’s how it works”, never was using it in my own architecture. Then why I started to do it, I had this urge to overuse decorators 😂

1

u/HammadBuilds 11d ago

Haha, I think that's how decorators get you 😂 First you use them because a framework requires them, and then suddenly you start seeing opportunities to use them everywhere. What made you start using them in your own architecture?

1

u/odimdavid 9d ago

Decoarators. Only used them with flask.

1

u/Spoutnik16_vs 8d ago

The so called decorator phase, I had it too

3

u/nala2624 10d ago

I still dont understand oop or why you would use it over separate variables for different objects.

5

u/Sweaty_Strike_7411 10d ago

Would you make a separate variable for password for EVERY user on a platform? Make an object that holds name, password, etc and every user is a different object. Objects group separate but different data.

2

u/HammadBuilds 10d ago

That's actually a really good way to explain it. The difference becomes much clearer when you think about managing hundreds or thousands of users instead of just one or two. OOP starts making more sense when you see how it helps organize data and behavior together.

2

u/468Cliothecat 10d ago

OOP was a dumpster fire for me too.

1

u/TsokonaGatas27 8d ago

Makes things cleaner instead of declaring a new variable for each use.

1

u/deadeye_82_1 6d ago

Because then you have everything at one place. Attributes attached to the instance and methods, to do something with the attributes.

1

u/avidresolver 4d ago

I learned Unity game engine before python, and that helped me a lot, because in Unity most of your objects are literal game objects, with components, variables, etc, all attached to them.

2

u/sleepbot63 11d ago

yield

3

u/HammadBuilds 11d ago

Yield is definitely one of those Python concepts that takes a while to fully understand. Generators make much more sense once you see how they work in practice!

1

u/Bubbaluke 9d ago

I’ve been trying to find a place to wedge a yield into my code because I think they’re so cool I just haven’t needed to write my own generator yet

0

u/sleepbot63 11d ago

nah i never brothered to learn yield evene after like 12yrsi think yea thisis my 12th yr of python. i couldn't be bothered i understand working of generators and other stuff but this yield is the only thing that i couldn't be bothered to learn lol

3

u/HammadBuilds 11d ago

12 years with Python and still avoiding yield is honestly hilarious 😂 If generators make sense to you, I guess you've found a way to get things done without worrying about every keyword. Respect for the 12-year journey!

2

u/Taco-Jedi 11d ago

Hash maps, and I still don't get them 😭

1

u/HammadBuilds 11d ago

Hash maps can be confusing at first 😭 Once you understand how keys map to values using hashing, things start to click. Definitely worth practicing with small examples!

2

u/AIDevUK 10d ago

Not using a semicolon. 10+ years in C#

1

u/HammadBuilds 10d ago

Haha, old habits die hard 😂 Switching from C# to Python must take some getting used to, especially when even a semicolon becomes a habit!

2

u/468Cliothecat 10d ago

Couldn’t make any sense out of OOP. I have a degree in mathematics, so I have documentary evidence that I’m not a dunce. But the more I studied OOP, the less sense it made.

2

u/HammadBuilds 10d ago

I think OOP is one of those concepts that can feel more complicated the deeper you study the theory. Having a strong mathematical background doesn't necessarily make it easier either. Sometimes understanding it through a practical project makes much more sense than studying abstract examples.

1

u/NullPointer-Except 10d ago

Hi c:

I'm with this on you. If it helps, OOP has many associated object calculi. Maybe one of those might help you understand it better?

2

u/468Cliothecat 10d ago

I think understand the notion of OOP in the abstract: Define the objects and then implement operations on those objects. But the syntax of Python is incomprehensible. Everything is a ‘self’ unless it isn’t. Then you have inheritance, where one object can be two or more things at once. And periods seem to be dropped into the code at random. I had high hopes of getting out of the soul-destroying job I have now, but it was not to be. :(

2

u/Independent-Bat9797 10d ago

Oops is relatively simple once you tried it in practice. If you build an app, chances are you app needs to handle stuff, maybe even multiple instances of stuff. Stuff has attributes and can do things. Multiple instances of stuff can do the same thing but may have different results because they have different attributes. Sometimes you want to create slightly different stuff that keeps track of changes to the original stuff, but without typing all the methods and attributes again, so you use inheritance and just write down the difference.

Also stuff needs to know if it handles its own shit or shit that is given to it thats what the self. annotation does.

1

u/holdmyrichard 7d ago

The way I learned and using mathematics as a reference.

Let’s take geometry for an example.
A square is an object. A triangle is an object. A circle is an object.

Let’s say you define an abstract class Shape that has the properties of area and perimeter.

A square inherits from Shape and defines its own implementation of how to get area and perimeter.

Same for circle - inherit from shape define its own implementation. But wait Circle has its own property - radius. So it introduces something new that Shape doesn’t have.

Triangle does the same for its own implementation of area and perimeter but now also introduces angles as a property that Circle or Square doesn’t have.

In essence OOP is basically defining a thing and that thing then deals with calculating or figuring out things that are relevant to the thing. No one outside has to know how the area of a Circle is calculated. The caller just asks the Circle for its area or perimeter. At its most basic OOP delegates behavior to an object. The object takes care of the implementation of the behavior. This allows encapsulation. The behavior is encapsulated inside the object. All the caller needs is an instance of the object. So

Circle a = new Circle(5)
area = a.area()

In this case you are saying Circle a is of radius 5
And then you ask it to tell you its area.

1

u/468Cliothecat 10d ago

What means ‘associated object calculi’?

1

u/NullPointer-Except 10d ago

I gotchu these slides have a nice introduction.

After reading... Turns out that as we have the untyped lambda calculus, the typed lambda calculus, and extensions such as system F that serves as foundations to express more rich features in a (usually functional) language, we also have different calculus that serves as foundations that accommodates richer OOP features in a convenient idiomatic^1 way.

^1. Idiomatic: easy to formally reason about.

2

u/468Cliothecat 10d ago

Thanks for trying, but this is way over my head.

1

u/Mundane-Mud2509 10d ago

Stop studying start building. It’s good for things like simulation where each object has inputs/outputs and internal processes

2

u/468Cliothecat 10d ago

Could you elaborate please? I really would like to be able to do this.

1

u/Spleeeee 10d ago

Oop makes more sense in languages where things are truly private, which they aren’t in Python. A thing I encounter a ton in cpp a bunch of bools is stored as bit flags on a single int. You don’t get the objects “is_some_shit” member, instead you call “is_some_shit()” which bit-maths you your answer. You can hide how stuff is stored or used to make it smaller or make certain states err or whatever, and expose a public api that consumers interact with.

2

u/Mundane-Mud2509 10d ago

Decorators probably. I still don’t fully “get” them

1

u/HammadBuilds 10d ago

Decorators are definitely one of those Python concepts that look confusing at first. I think they become easier once you understand that they're basically a way to add functionality to an existing function without changing its original code. Still takes some practice to fully click though!

10

u/Wooden_Intention8642 11d ago

The fucking main thing

2

u/Dr-Ebola 10d ago

😂 I hear ya

1

u/nodrexal 10d ago

The main thing is usually where it clicks or falls apart, so that tracks. Python has a way of making the basics look easy right before it smacks you with the real stuff.

4

u/Link2212 11d ago

indexing caused me the most issues by far.

I thought I was past the beginner stage, but then people are saying things like multithreading and APIs which I'm learning now, so I guess I'm still a beginner lol

1

u/joebloggs81 10d ago

Decorators. Those god damn decorators. I mean I’m still a beginner, and only working on a lightweight project at work (heavy for me, lightweight for anyone else) but it does not matter how many descriptions, examples or whatever I see, it ain’t clicking!

2

u/HammadBuilds 10d ago

I think decorators are a perfect example of something that looks much harder than it actually is. The tricky part isn't the syntax, it's understanding why you'd need them in the first place. Once you see a real use case, things start making more sense.

1

u/joebloggs81 10d ago

Yeah I suppose thats much like anything. In my initial learning push, the examples I saw (which were of course basic) were almost over-simplified to the point I couldn’t make sense of it. I had a stint learning some Django, not necessarily to build with it but more to understand what I can do, and of course that uses decorators all over the place, albeit I found that complex.

I’ve not needed to use them yet so generally forget about them.

1

u/Spleeeee 10d ago

No I think the syntax makes it harder in Python bc of white space and makes newcomers confused that you can make a func in a func and return the inner one.

A js wrapper is (imo) literally easier to comprehend than a python one because you can write it in such a way that makes it obvious where things start and end.

2

u/AdDiligent1688 11d ago edited 11d ago

asynch, multithreading (GIL as well), multiprocessing, e.g. concurrency, and socket programming too (makes more sense after you learn OSI and protocols)

2

u/mountain-snowman 11d ago

I am a pro python programmer and I am using Python for 10+ years. I still sometimes mix up between else and finally in try...except.

1

u/Thick_Local2515 10d ago

Decorators

1

u/Kadabrium 10d ago

Difference between print and return, especially because python has a terminal mode where you can write bare lines of code and it returns/prints the result ( i still don't know which one is technically done first in this mode)

1

u/Decryptic__ 10d ago

I worked with async, APIs and sich things before I knew what recursions are. And believe it or not. It wasn't an AI that thought me this, it was a Reddit user that ask me why I'm using a loop in a function rather than recursion and call itself again.

1

u/Only_lurking_ 9d ago

Descriptors. I still have to look up what the dunders are. I use them so rarely it never sticks.

1

u/Independent-Sound-92 9d ago

Yo estoy estudiando industria 4.0 y python es el lenguaje elegido para este entorno industrial voy en el segundo nivel y aun no entiendo casi nada

1

u/tonystark19541959 9d ago

For me, it was definitely OOP. I could understand classes and objects individually, but actually understanding WHY and WHEN to use them took quite a while.

Decorators and generators ("yield" especially) were also confusing initially. I think the biggest mistake I made was trying to understand everything theoretically instead of actually building things with them.

One thing I'd suggest is to stop watching tutorials after a point and start making small projects. You'll run into these concepts naturally, and that's when they start making sense.

Still learning myself, but honestly, building things and breaking your own code teaches you a lot more than you'd expect!

1

u/sovura 7d ago

The clear answer is decorators. Still don’t understand it fully.

1

u/ActuatorBrilliant595 7d ago

while True. okay true what ? if i type there "true" then how is it actually true? wtf ?

1

u/Javyn11 7d ago

Yes go for it !! Uni is good if you wanna study and will get a good amount of exposure , and anyday better than so called colleges

1

u/Careless-Midnight617 6d ago

I am so entertained by people saying that they do not understand OOP or OOPS as it was called 30 years ago! No wonder I cannot find fundamentally sound people. Absolutely none when conducting interviews. I have done Java all my life and just love how elegant and deeply simple this concept is and how it has got with how you closely you link things and abstract concepts in your mind AND MATHEMATICS does not help you do that but I do think that IQ does.

1

u/Intelligent_Part101 5d ago

Other languages don't have decorators, and the programmers do just fine without them. I suggest to learn decorators if your framework requires them, but otherwise don't worry about it.

1

u/Niklas_Osmund 4d ago

Honestly, names vs. objects. I thought b = a made a copy, then spent an evening wondering why changing one list changed the other. Same thing bit me again with a def f(x, items=[]) default. Decorators and async were easy after that, because it’s all just names pointing at things :)

1

u/_rowanmaxwell_5 3d ago

OOP - I never feel like I'm using it as well as I could

1

u/Xenxen-OnDerst2008 1d ago

Moi je ne connais rien en Python Et j'aimerais apprendre beaucoup de Python..

0

u/[deleted] 10d ago

[removed] — view removed comment

1

u/HammadBuilds 10d ago

That's actually reassuring to hear! I sometimes feel like watching too many tutorials just makes things more confusing. Building small projects and experimenting sounds like a much better way to make these concepts stick. Definitely going to try that approach!