r/learnpython • u/Far-Cheesecake-1326 • Jan 16 '26
What beginner Python mistake took you the longest to understand?
I keep seeing the same beginner mistakes again and again.
For me it was:
indentation errors
confusing lists and tuples
forgetting to return values from functions
Curious what mistakes confused you the most when you were starting.
5
u/HummingHamster Jan 16 '26
Mutable vs immutable. Coming from c++ and dive straight in python without learning the basic. I was overwriting dict values in a function, without intending for it to be permanent outside function.
Took me quite a while to debug because I was so stucked on the c++ knowledge of local scope.
4
u/Far-Cheesecake-1326 Jan 16 '26
This is a classic trap, especially if you come from C/C++. Dictionaries and lists behaving differently than expected can be brutal at first.
1
u/Far-Cheesecake-1326 Feb 23 '26
Indentation is brutal at first because Python uses it structurally, not cosmetically.
What helped me understand it was thinking of indentation as "block ownership".
If a line is indented, it belongs to the line above.
I actually wrote a short breakdown of this and a few other beginner traps because I kept repeating the same explanation. It's in my profile if useful.
4
u/ectomancer Jan 16 '26
I still haven't worked it out, the '__new__' special method.
1
u/Goingone Jan 16 '26
What part don’t you understand?
0
u/KptEmreU Jan 16 '26
Yeah that should be better naming for the magical functions for sure as in Main too. It is just grammar I know, but until you hit this barrier python is a great language with very few requirements.
a,b = 3,4 a+b 7
Then magically underscores special functions
1
u/vivisectvivi Jan 16 '26
Python was my first language so i like when i started it really made no sense at all to me the difference between printing a value inside a function and returning it.
1
u/Far-Cheesecake-1326 Jan 16 '26
This one confuses a LOT of beginners. Print feels like it “works”, until you try to reuse the value later. That’s usually the moment it clicks.
1
u/QuasiEvil Jan 16 '26
Package and module structure; pyproject.toml; working with venvs
1
u/Far-Cheesecake-1326 Jan 18 '26
I absolutely agree. The funny thing is that these things aren’t actually “difficult”—they’re just introduced way too early for most beginners, without enough context. When you revisit them later, they suddenly make perfect sense.
1
u/pixel-process Jan 17 '26
Relative imports for my scripts! For years, I had to keep things in a single file or directory because as soon as I started trying to move modular sections, everything would break. Always made me feel like a beginner unable to write real code.
0
u/Far-Cheesecake-1326 Jan 18 '26
Αυτό είναι τόσο αληθινό. Για πολλούς αρχάριους, το “όλα σε ένα αρχείο” φαίνεται πιο ασφαλές, γιατί μόλις σπάσεις τον κώδικα σε modules/imports, κάτι πάντα σπάει 😅 Συνήθως το πραγματικό πρόβλημα είναι το πώς τρέχεις το script και όχι τα ίδια τα imports — αλλά αυτό γίνεται ξεκάθαρο πολύ αργότερα.
2
u/sacred__nelumbo Jan 16 '26
Indentations I cannot
2
u/AGx-07 Jan 16 '26
I struggle with this too and mainly because my experience is primarily with SQL, DAX, HTML, CSS, and some JS, where indentation doesn't matter to the code and I do it for styling and I have to remember here that I cannot style my code the way I'd like because Python actually cares about those indentations.
1
1
u/Chemical-Bridge-1976 Jan 16 '26
As a beginner to coding(py),I used to hardcode stuff and then know that there's a dedicated built-in function for it. So its built-in functions for me, can't keep the track of them :/
1
u/cdcformatc Jan 16 '26
sorted(list) versus list.sort() and their return values
mutable function parameter default values
9
u/CrucialFusion Jan 16 '26
I dunno, I already had a lot of experience when I jumped into Python, but I definitely keep inserting semicolons here and there.