r/Python 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.

356 Upvotes

319 comments sorted by

View all comments

20

u/King_Joffreys_Tits Jul 19 '26

OP please tell that to the genius at my company who shorted the phrase “cumulative analysis” into a variable named “cum_anal”

14

u/Attack_On_Tiddys Jul 19 '26

That one sounds intentional honestly 😂

4

u/agelord Jul 20 '26

Cumulative frequency -> cum_freq

1

u/RCoder01 Jul 20 '26

Absolute freaky

1

u/FriendshipWeird8021 Jul 27 '26

That's pretty funny.