Live data from Hacker News

What are some good and bad names you've encountered in Python code?

news.ycombinator.com

1–10 of 11 posts

Re: What are some good and bad names you've encountered in Python code?

#4
post #3
post #2

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 ...

Re: What are some good and bad names you've encountered in Python code?

#7

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?

Re: What are some good and bad names you've encountered in Python code?

#9
post #4
post #3

Earlier quoted context omitted.

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. :-)

Re: What are some good and bad names you've encountered in Python code?

#10
post #8

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.
Post reply on HN