r/learnpython • • 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.

2 Upvotes

26 comments sorted by

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.

3

u/V01DDev Jan 16 '26

Oh yes, i'm coming from C and C#, from time to time i use { } and ; by mistake

3

u/DreamDeckUp Jan 16 '26

not having curly brackets is the only syntax thing I would change about python; indentation is too ambiguous

1

u/Far-Cheesecake-1326 Jan 16 '26

Ναι, οι εσοχές είναι από τα πιο ύπουλα λάθη. Μερικές φορές ο κώδικας φαίνεται σωστός, αλλά η Python “βλέπει” κάτι τελείως διαφορετικό.

2

u/hugthemachines Jan 16 '26

Did you not use indentation in C and C#? To me, personally, who most often use Python and sometimes Java I sometimes think it is annoying when I need to change something to sit and count curly braces.

To me, curly braces affection seems more like a Stockholm syndrome situation. The parsers in the old days needed them so people got so used to them it felt like there was a real advantage to have them, even to humans and the monitor width was small so indentation sometimes was impossible. Now we have wide monitors and we know descriptive (also long) variable names can be an advantage, and we can have indentation when it is required.

0

u/V01DDev Jan 17 '26

I did yeah, but still feels kinda weird to rely only on that, when you spend few years writing in programming languages that need semicolons and brackets, it just becomes weird to write it differently. But still, got used to it :D

1

u/AGx-07 Jan 16 '26

100%. My only experience is with flavors of SQL, DAX, and some JS and as I'm learning Python I just really wish I could use parenthesis or brackets. The colon-indentation thing just doesn't look right to me.

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

u/Goingone Jan 16 '26

Lookup the reasoning for the list comprehension syntax.

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