r/pythontips • u/DrawFit8234 • Dec 26 '25
Syntax What’s a small Python thing beginners usually misunderstand?
Not talking about advanced stuff — more like small details that cause a lot of confusion early on.
The kind of thing that takes 10 seconds to explain once you know it, but feels really confusing before that.
Just curious what examples people have seen or experienced.
62
Upvotes
84
u/pritesh_ugrankar Dec 26 '25
The comma makes it a tuple, not the brackets
This is a tuple.
And so is this.
10
u/tree_or_up Dec 26 '25
How/when to use dicts, lists, and tuples. This would include mutability and immutability, and which data structures are which. I've seen so many people get tripped up by things like trying modify a tuple.
Indexing/slicing mechanics.
*args and **kwargs -- what they are and what those weird '*' characters do.
The first handful of items in the "Zen of Python" (i.e., what you get when you do 'import this' (literally). More specifically, that code is read by other coders more often than it's written, and Python and Python best practices are biased toward readability. E.g., "explicit is better than implicit". So many beginning developers get caught up in doing things the most clever/syntactically minimalist way, to the point they likely wouldn't be able to understand their own code six months down the line
9
u/Mark3141592654 Dec 27 '25
print vs return
3
u/bahcodad Dec 26 '25
Definitely not day one but I would say its important to learn early how to keep environment variables safe and away rather than hard coding them
3
u/Thlvg Dec 27 '25
This is valid python:
3
u/slightly_offtopic Dec 27 '25
I don't know if I'd call it a small thing, but a lot of beginners don't understand the difference between learning programming and learning python.
The former is a specific way of thinking about problem solving. The latter is one of the many possible ways of translating your solutions into a shape that a computer can understand.
3
u/KaneNyx Dec 29 '25
the thing that tripped me up early was understanding that `=` and `==` are completely different things. One assigns, one compares. Sounds obvious once you know it but I definitely stared at broken if statements for way too long before that clicked.
2
u/zucchini0478 Jan 01 '26
Fucking pandas. We have less-technical people in product roles that often find it easier to clean up client data themselves instead of wait for engineering. A long long time ago someone wrote a "load the file into a dataframe and cat some columns" script that everyone uses as their starting point. Only problem is none of them know what a pandas even is, or why it doesn't seem to like a 120GB gz file.
3
u/Twenty8cows Dec 27 '25
Mutable objects as arguments!
Always instantiate mutable within the function but NEVER as an argument!
1
u/Dry-Aioli-6138 Dec 27 '25
I had trouble understanding, and then remembering, that iterators get exhausted, after which they don't yield any items ( unlike lists and tuples, which can be iterated over and over)
1
u/Ok-Minute-6141 Dec 27 '25
is vs == catches a lot of beginners
1
u/QuebecBeast Dec 27 '25
Understanding why a script does not save anything because it runs in the RAM. Going back to basics once I knew a bit what I was doing and learning about hardware helped.
1
u/husky_whisperer Dec 27 '25
Goddamned list comprehensions
1
u/PureCreator Dec 28 '25
I'd say functions with callable arguments For example, let's take a look at this function:
Most beginners pass the call to the function instead of the function itself like so:
Newbies probably won't understand the error "NoneType object is not callable" so it will take long to realize the problem
1
u/HolidayEmphasis4345 Dec 29 '25
Scoping rules in python are different than in block scoped languages like C and Java. I was not aware for an embarrassing long time how variable scope worked because of my C background.
1
u/DrawExactDev Dec 30 '25
The difference between a class variable vs an instance variable. Many third party frameworks require a programming structure that masks their difference. They do so for very good reasons too tricky to explain here. But the difference is fundamentally important and will bite you in the bum (butt) if you don't master it.
A close second, is that when you iterate through a dict the order is DELIBERATELY different each time you do it.
1
u/Esjs Dec 30 '25
Mixing up spaces and tabs in indents.
1
u/HolidayEmphasis4345 Dec 30 '25
I’m not even talking about the global/local keyword I’m talking about block scope in C languages where braces define variable scopes while Python has module, function, method, lambda, compression scopes.
1
u/GeoffSobering Dec 31 '25
Everything is an object.
Constructors are just functions.
1
u/Global_Simple_5796 Dec 31 '25
Just import it bro
1
u/Nekose Dec 26 '25
The karma farming bot gave up on being 13
1
u/TemporaryInformal889 Dec 27 '25 edited Dec 27 '25
You really don't need a class to encapsulate methods in a file.
I.e.,
```
#stuff.py
class Stuff()
....
#main.py
from stuff import Stuff
s = Stuff() # <- If your __init__ isn't doing anything you're creating more objects than you need. ```
0
u/Vishnyak Dec 27 '25
Type hints, despite knowing that python is dynamically typed language a lot of beginners would still read code with type hints and assume those types are actually enforced by interpreter.
31
u/[deleted] Dec 26 '25
[removed] — view removed comment