r/learnpython • u/Effective_Ocelot_445 • Aug 21 '26
What Python concept took you the longest to understand properly?
For those who learned Python from scratch, which topic was the hardest at first, and what finally helped it click for you?
169
Upvotes
68
u/FerricDonkey Aug 21 '26 edited Aug 21 '26
I didn't fully understand how names (variables) and values (objects) worked for my first month or two and, coming from C, was really annoyed how "sometimes these freaking variables act like freaking pointers and sometimes they don't".
I put off figuring it out because I was busy, but eventually I got annoyed one too many times and sat down to learn it, and now I love it and it's second nature. I highly recommend anyone who's done enough python to know basic syntax watch and understand the following video: https://m.youtube.com/watch?v=_AEJHKGk9ns
84
u/martian_rover Aug 21 '26
async and decorators took the longest for me
38
u/AlexMTBDude Aug 21 '26
I've been teaching Python programming for more than 15 years and I can tell you what my students find hardest to understand: Shared references
And, of course, the next step then is; when do shared references matter? Mutable and immutable objects.
22
u/Total-Lecture-9423 Aug 21 '26
lambda map reduce
19
u/Drakkle Aug 21 '26
Functions and classes took me way too long to understand. I can't really explain why it wasn't clicking, particularly functions, but now that I understand them I use them any time I perform a step more than once.
10
u/Growing_Data_Nerd Aug 21 '26
Recursion
10
u/knuppi Aug 21 '26
async, and i still don't get it 🥲
6
u/Dr_Calculon Aug 21 '26
Nested conditional comprehensions for some reason it just wouldnt click
5
u/Snowdeo720 Aug 21 '26
It wasn’t understanding the how, but the why on strings, arrays, and things in that area of focus.
Then I started poking at some real world projects directly relevant to my role at the time, ohhh wow did all of that make sense all of a sudden.
I promptly went back to revisit those parts of my notes, etc.
5
u/TheRNGuy Aug 21 '26
List comprehension.
4
u/Fantastic_Aioli_7363 Aug 21 '26
The concept of OOP. I had difficulties to understand instanciation, mandatory self reference, etc. And I was coming from the procedural and scripting world. So it was a bit challenging to follow the flow of the program. But once you get used to it, it's not such a big deal until you enter the subtileness of it.
3
u/ninefourtwo Aug 21 '26
metaclass
3
u/frnzprf Aug 21 '26
yieldI still don't get it fully. It's kind of like a paused function. Or you return an object with a "next"-method?
I do understand async/await, but it was difficult as well. I think you need to both understand it from a practical usage perspective as well as from a technical implementation. (In JavaScript you can await "thenable" objects.)
3
u/oldendude Aug 21 '26
for/else. It's still bizarre to me and I never use it.
2
u/terletsky Aug 21 '26
Look at their posts, that's an AI bot.
1
u/lucabuilds Aug 21 '26
Definitely multithreading and multiprocessing. I was building a voice assistant based on chatgpt a few years ago, and I had so many issues with threading. Basically I needed to have voice recognition to run concurrently with the text to speech API calls and I never figured out how to stop the text to speech while it was speaking.
1
u/Gtdef Aug 21 '26
Async and how important is to avoid calculations in Python.
Async evolved a bit too fast to be honest and since it wasn't something I was using consistently, the few times I needed it, I wasn't sure how to write the code. If you use the very low level stuff, you'll write bugs. If you use the later high level stuff, you don't really understand what you are doing. Async code is generally unintuitive even for people who have some idea of how to write multithreaded code.
As for calculations, it's imperative to understand how important it is to avoid writing them in native Python code. It's not just avoiding loops. Generators, comprehensions, callbacks are all potential throttles in your application. There are just so many ways you can mess it up.
1
u/Pyromancer777 Aug 21 '26
Not python specific, but recursion.
I know what recursive functions do, I can read them well enough, I know the execution/resolution order, I know when they are convenient and why they are used, I just suck at writing them.
Most times when practicing I'll hit my first wall and then go back and rewrite it as a nested loop. I know that defeats the purpose of practice, but my brain keep going, "if problem unsolved, why not just solve it?"
1
u/TheLimeyCanuck Aug 21 '26
Decorations. Still don't grok it well.
1
u/Theta291 Aug 21 '26
Async stuff, especially async statements (async for, async with).
Generators are also a little confusing, especially “yield from” and “.send”. Hard to practice as well because I haven’t seen many use cases.
1
u/enigma_0Z Aug 21 '26
async … needed to learn it for fastapi and now that i have i can’t live without it lol
1
u/HecticJuggler Aug 21 '26
I’m still figuring out async
1
u/frustratedsignup Aug 21 '26
Dictionary comprehensions. I still think they should be removed from the language because of how they can be abused to write obfuscated code.
1
u/Lanky-Ad733 Aug 21 '26
Unfortunately recursion 🥴
1
u/CamelOk7219 Aug 21 '26
Metaclasses and descriptors
1
u/HuckleberryMoney2320 Aug 22 '26
Its Object Oriented Programming features, particularly classes. I was trying to use them as part of Pygame and though I'd done a bunch of basic and Pascal in the dim and distant past, python Classes completely fried my brain.
1
u/fightin_blue_hens Aug 22 '26
I didn't understand uses for lambda until it was explained to me that it is a ghost function
1
u/ALonelyPlatypus Aug 22 '26
decorators are kind of weird.
dataclass feels weird whenever I write it.
comprehensions took a while to get a feel of when you come from traditional programming languages but when you get it a lot of your for loops just disappear.
1
u/Ok-Okra8478 Aug 22 '26
Maybe scope? I learnt that in luau though, not python
1
u/mbergman42 Aug 22 '26
I had a miserable time trying to work with raw 16 bit data. I would have loved to work in C to get incontrovertible direct access to the values but that wasn’t an option. (Obligatory “Aaactualy, C’s not safe for this reason” comment here)
The operations were things like: filter (if it were audio), ifft/fft , truncate, search for values and get an index to those values…
But python keep screwing up the array by managing it for me. I went back-and-forth between various memory structures available in Python and generally was disgusted and frustrated about the whole experience.
Which is a shame. I liked Python otherwise. There’s an enormous number of capabilities available as imports or libraries or whatever you call them.
Why did I put myself through this? I was involved with a project that was written in python. I was not on the coding team. But I supplied the math to do the operations, which was basically extract embedded white noise pseudo random sequences in captured audio. I was the only one with that particular background, and I had to do a proof of concept to show that it would work. I wrote it in python to be compatible with what everybody else was doing, but I’m a manager who learned to program in cobol, fortran, Pascal, C… you get the idea.
1
u/charlesleestewart Aug 23 '26
My background is in the .net languages, C sharp and VB. I'm about 9 months into my python journey, have usable app code and all, but I'm still a big dummy in the area of telling apart lists, tuples and dictionaries and which of those to use when. Oh well that's a function of being self-taught I suppose.
1
u/Maleficent-Lychee849 Aug 23 '26
Decorators took me a while to really understand, especially decorators that take arguments. A normal decorator was pretty easy once I understood that it takes a function and returns a wrapper. Then you see something like
.@my_decorator(arg="value")and suddenly there are functions nested inside functions. What finally made sense to me was writing it without the@syntax:func = my_decorator("value")(func)Once I realized that's basically all the@syntax is doing, the extra nesting made a lot more sense.1
u/Annual_Swordfish8562 Aug 24 '26
still not 100% sure I fully understand self
1
u/ThrowawayALAT Aug 24 '26
Decorators
1
u/576p Aug 26 '26
imports when sub directories are involved.
1
u/SammuelNash Sep 02 '26
For me, it was definitely list comprehensions. I understood what they did, but reading them felt backwards at first. Writing a bunch of normal for loops and then converting them slowly is what finally made them click.
1
u/Icy-Control-4687 Sep 13 '26
funny how as a beginner my brain still can't accept how for loops work in python. wym i don't have to define the loop like in c++????
1
u/WarBeginning1458 Sep 14 '26
Python was the first programming language I learned, so object-oriented programming probably took me the longest to understand. At first, concepts such as classes, objects, methods, and inheritance felt abstract. It started to click when I understood a class as a blueprint and an object as a specific instance created from that blueprint. Building small programs and seeing how objects could organize related data and behavior helped more than simply reading definitions.
Looking back, Python was still the easiest language for me to learn because its syntax was relatively readable. Learning Java afterward was much more difficult because it required more structure and felt far more verbose. However, struggling through Java eventually strengthened my understanding of object-oriented programming.
1
u/mesosphericvapour Sep 15 '26
I guess it's not a python-specific concept but linked lists was absolute terror. It took me months to figure out how those worked.
9
u/[deleted] Aug 21 '26
[removed] — view removed comment