Hacker News new | ask | show | jobs
What are some good and bad names you've encountered in Python code?
3 points by rekahrv 1118 days ago
3 comments

Some good names I’ve seen are descriptive, consistent, and follow PEP 8 conventions. Some bad names I’ve seen are vague, misleading, or too long or short.
I agree with those points, both on the positive and negative side. Do you have some examples of vague or misleading names?
Do you mean names of variables, functions etc?
Yes, exactly. Thanks for the clarifying question. :-)

Any kind of artifact in code: modules, functions, classes, arguments, variables...

Ones that used to annoy me were in the standard library, in particular the unitest module with camel-case functions (assertEqual and so on), I've seen this justified by it being old and predating the snake-case conventions, but surely assert_equal could have lived alongside the older names. Moot now that I've switched to pytest of course ...
Yeah, anything that contradict s PEP-8 conventions looks unnatural in Python. :-)
Good and bad names are a result of context.
Yes, that's a great point. Some names are generally unclear, but more often, they are unclear in a context. Do you have some "contextual" examples?
The worst was "leading indicator". It was used initially to mean inputs to a machine learning model, but it organically spread to refer to almost any form of data at any point in the ML pipeline.
That's an interesting example. Also, the same pattern has happened to other terms as well: 1. At first, a quite specific meaning. 2. As time goes on, the same term gets used for more & more things.