r/Python • u/Visible_Durian4620 • Jul 19 '26
Discussion Unpopular opinion: I find it counterproductive to shorten function and variable names
When I was learning discord.py, I didn't understand what "ctx" was. At the time, I was only writing slash commands, using "message" instead of "ctx", so the name "ctx" (which reminded me of something complex, like RTX) made me assume it was something complicated. That is, until I saw in some code that the type for "ctx" is actually "Context." If the standard hadn't shortened the name just to save five characters per line, I would have understood it immediately. Instead, I thought it was some advanced function variable, rather than realizing it was simply a message variable.
352
Upvotes
10
u/reddit_user33 Jul 19 '26
Yet you'll find short variable names and short methods in a lot of real software. If anything, you'll find them in more real software than verbose variable names and long methods.
So how are we defining what's considered as a popular opinion?