AllenDowney / ThinkStats2

Text and supporting code for Think Stats, 2nd Edition
http://allendowney.github.io/ThinkStats2/
GNU General Public License v3.0
4.03k stars 11.31k forks source link

Follow common naming conventions/distinguish classes and functions #21

Closed nicktimko closed 9 years ago

nicktimko commented 9 years ago

I get extremely confused when reading your book as it's difficult to tell what's a function and what's a class. PEP-8 generally recommends that classes are named with CapWords and functions with lower_case ("words separated by underscores as necessary to improve readability"). The other common guide, Google's Python Style Guide, also recommends CapWords for classes and lower_case_with_underscores for functions.

I'm not advocating that one or the other must be rigidly followed, but at the very least I'd prefer that classes and functions/methods are named differently.

AllenDowney commented 9 years ago

Nick, you are right about the style guides. My only excuse is that I developed this library while working at Google and their internal style guide requires camel caps for function and method names (but not their external style guide).

At some point I might add aliases so you can refer to functions and methods using either style. thinkplot.py already provides this feature.

On Mon, Apr 6, 2015 at 12:45 PM, Nick Timkovich notifications@github.com wrote:

I get extremely confused when reading your book as it's difficult to tell what's a function and what's a class. PEP-8 https://www.python.org/dev/peps/pep-0008/#prescriptive-naming-conventions generally recommends that classes are named with CapWords and functions with lower_case ("words separated by underscores as necessary to improve readability"). The other common guide, Google's Python Style Guide https://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Naming#Naming, also recommends CapWords for classes and lower_case_with_underscores for functions.

I'm not advocating that one or the other must be rigidly followed, but at the very least I'd prefer that classes and functions/methods are named differently.

— Reply to this email directly or view it on GitHub https://github.com/AllenDowney/ThinkStats2/issues/21.