23
I was reading a beginner Python book and it said you can name a variable almost anything, but 'list' is a bad idea.
Found this out the hard way when my simple script broke because I named something 'list' and then tried to use the actual list() function later (oops).
3 comments
Log in to join the discussion
Log In3 Comments
luna_craig581mo agoMost Upvoted
Understand the point about learning from errors, but having a reference like @riverm48's cheat sheet is just practical. It stops you from wasting time on simple mistakes you can avoid. That lets you focus your energy on the harder, more interesting bugs that actually teach you something. Learning what not to do is just as important as figuring things out the hard way.
8
riverm482mo ago
Yeah, that's a classic beginner trap. I started keeping a little cheat sheet of those reserved words next to my monitor. It saves you from the weird bugs later when your code just stops making sense.
5
white.seth2mo ago
Honestly the cheat sheet idea feels like a band-aid. Memorizing a list of reserved words is just busy work that doesn't really teach you why they're reserved. You learn them way faster by actually hitting the errors and having to debug it yourself. That struggle makes it stick.
9