470,638 Members | 1,581 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,638 developers. It's quick & easy.

Am I crazy regarding the style guide for function names?

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?
Jul 18 '05 #1
9 1381
Leif K-Brooks wrote:
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.p...1=1.20&r2=1.24

:-)

Peter

Jul 18 '05 #2
Peter Otten wrote:
Leif K-Brooks wrote:

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.p...1=1.20&r2=1.24

:-)


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
Jul 18 '05 #3
>>>>> "Peter" == Peter Hansen <pe***@engcorp.com> writes:

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?

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #4
Peter Hansen wrote:
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
Jul 18 '05 #5
Ville Vainio wrote:
>>"Peter" == Peter Hansen <pe***@engcorp.com> writes:


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>
Jul 18 '05 #6
"Michael Geary" <Mi**@DeleteThis.Geary.com> wrote in message
news:10*************@corp.supernews.com...
Peter Hansen wrote:
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!)
Likewise.

John Roth
-Mike

Jul 18 '05 #7
"Michael Geary" <Mi**@DeleteThis.Geary.com> wrote in message news:<10*************@corp.supernews.com>...
Peter Hansen wrote:
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.


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.
Jul 18 '05 #8
On Sat, 19 Jun 2004 10:05:03 -0700, Michael Geary <Mi**@DeleteThis.Geary.com> wrote:
Peter Hansen wrote:
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!)


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?

--
"It's easier to find people online who openly support the KKK than
people who openly support the RIAA" -- comment on Wikipedia
(Email: zen19725 at zen dot co dot uk)
Jul 18 '05 #9
The PEP has been updated more recently than this.

You can view the history of the PEP here:
http://cvs.sourceforge.net/viewcvs.p...s/pep-0008.txt

The change you're talking about was probably made last September:
http://cvs.sourceforge.net/viewcvs.p...1=1.20&r2=1.21

Jeff

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

iD8DBQFA2XZ7Jd01MZaTXX0RAgOZAJ9H66ya4kvCfU6LelPJK1 5u2beYoQCdEtpU
m/CfvOUUiKtMdLXNEuGW3XE=
=OjAB
-----END PGP SIGNATURE-----

Jul 18 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by David MacQuigg | last post: by
31 posts views Thread by bart | last post: by
39 posts views Thread by Patrick | last post: by
77 posts views Thread by M.B | last post: by
1 post views Thread by RayS | last post: by
4 posts views Thread by Sreekanth | last post: by
10 posts views Thread by sam_cit | last post: by
8 posts views Thread by Darren Dale | last post: by
1 post views Thread by Korara | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.