6 ms·
What are some good and bad names you've encountered in Python code?
- jjgreen 3y agoDo you mean names of variables, functions etc?
- rekahrv 3y agoYes, exactly. Thanks for the clarifying question. :-) Any kind of artifact in code: modules, functions, classes, arguments, variables...
- jjgreen 3y agoOnes 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 ...
- rekahrv 3y agoYeah, anything that contradict s PEP-8 conventions looks unnatural in Python. :-)
- Kinsley89 3y agoSome 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.
- rekahrv 3y agoI agree with those points, both on the positive and negative side. Do you have some examples of vague or misleading names?
- hitchstory 3y agoGood and bad names are a result of context.
- rekahrv 3y agoYes, 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?
- hitchstory 3y agoThe 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.
- rekahrv 3y agoThat'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.