Am I crazy regarding the style guide for function names?

L

Leif K-Brooks

I try to make my code comply to the Python style guide
(http://www.python.org/peps/pep-0008.html). Last time I read it, I swear
that it said to use CamelCase for often-used functions and
lower_case_with_underscores for rarely-used utility functions. Now it
says to use low_case_with_underscores for everything, but it claims to
be last updated in 2001. Am I crazy?
 
P

Peter Otten

Leif said:
I try to make my code comply to the Python style guide
(http://www.python.org/peps/pep-0008.html). Last time I read it, I swear
that it said to use CamelCase for often-used functions and
lower_case_with_underscores for rarely-used utility functions. Now it
says to use low_case_with_underscores for everything, but it claims to
be last updated in 2001. Am I crazy?

Not yet, according to

http://cvs.sourceforge.net/viewcvs.py/python/python/nondist/peps/pep-0008.txt?r1=1.20&r2=1.24

:)

Peter
 
P

Peter Hansen

Peter said:

Judging by the wording of the "function names" section before and
after the edit, the earlier version which "allowed" mixedCase names
was merely being descriptive (saying what the codebase currently
looked like), while the new version is being *prescriptive* (attempting
to force a particular style by defining it as the standard).

Personally, I don't like the change, but I also have no intention of
paying attention to it. Now that the editor and tab-wars are over,
we have to have _something_ to argue over, don't we? ;-)

-Peter
 
V

Ville Vainio

Peter> Personally, I don't like the change, but I also have no
Peter> intention of paying attention to it. Now that the editor
Peter> and tab-wars are over, we have to have _something_ to argue
Peter> over, don't we? ;-)

Tab wars are over? Do we finally have the official endorsement to burn
tab-users at stake?
 
M

Michael Geary

Peter said:
Judging by the wording of the "function names" section before
and after the edit, the earlier version which "allowed"
mixedCase names was merely being descriptive (saying what
the codebase currently looked like), while the new version is
being *prescriptive* (attempting to force a particular style by
defining it as the standard).

Personally, I don't like the change, but I also have no intention
of paying attention to it. Now that the editor and tab-wars are
over, we have to have _something_ to argue over, don't we? ;-)

I'm glad I'm not the only one. :)

ClassesLikeThis and methods_like_this sounds like a way to make everybody
unhappy: people who hate MixedCase and people who hate
names_with_underscores.

Ruby uses exactly this same convention. I have no idea why.

Myself, I'm sticking with ClassesLikeThis and methodsLikeThis for my Python
and Ruby code. (I don't like underscores at all!)

-Mike
 
P

Peter Hansen

Ville said:
Peter> Personally, I don't like the change, but I also have no
Peter> intention of paying attention to it. Now that the editor
Peter> and tab-wars are over, we have to have _something_ to argue
Peter> over, don't we? ;-)

Tab wars are over? Do we finally have the official endorsement to burn
tab-users at stake?

Apparently I spoke too early. <double wink, this time, for safety>
 
J

John Roth

Michael Geary said:
I'm glad I'm not the only one. :)

ClassesLikeThis and methods_like_this sounds like a way to make everybody
unhappy: people who hate MixedCase and people who hate
names_with_underscores.

Ruby uses exactly this same convention. I have no idea why.

Myself, I'm sticking with ClassesLikeThis and methodsLikeThis for my Python
and Ruby code. (I don't like underscores at all!)

Likewise.

John Roth
 
D

Dan Bishop

Michael Geary said:
I'm glad I'm not the only one. :)

ClassesLikeThis and methods_like_this sounds like a way to make everybody
unhappy: people who hate MixedCase and people who hate
names_with_underscores.

It also has the disadvantage that changing a function from a normal
function to a class constructor (like was done with the built-in
types) forces you to break the naming convention. In fairness, I
don't name functions with this in mind, either.
Myself, I'm sticking with ClassesLikeThis and methodsLikeThis for my Python
and Ruby code. (I don't like underscores at all!)

I use ALL_CAPS_WITH_UNDERSCORES for "constants", but in general I
don't like underscores, and use the same ClassName and methodName
convention that you do.
 
P

phil hunt

I'm glad I'm not the only one. :)

ClassesLikeThis and methods_like_this sounds like a way to make everybody
unhappy: people who hate MixedCase and people who hate
names_with_underscores.

Ruby uses exactly this same convention. I have no idea why.

Myself, I'm sticking with ClassesLikeThis and methodsLikeThis for my Python
and Ruby code. (I don't like underscores at all!)

How do you find Ruby? From what I've read of it, it has some nice
features, and is similar to Python in many ways. Do you find it is
so similar that you get confused between the two?
 
J

Jeff Epler

The PEP has been updated more recently than this.

You can view the history of the PEP here:
http://cvs.sourceforge.net/viewcvs.py/python/python/nondist/peps/pep-0008.txt

The change you're talking about was probably made last September:
http://cvs.sourceforge.net/viewcvs.py/python/python/nondist/peps/pep-0008.txt?r1=1.20&r2=1.21

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFA2XZ7Jd01MZaTXX0RAgOZAJ9H66ya4kvCfU6LelPJK15u2beYoQCdEtpU
m/CfvOUUiKtMdLXNEuGW3XE=
=OjAB
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top