473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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 1482
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: David MacQuigg | last post by:
I have what looks like a bug trying to generate new style classes with a factory function. class Animal(object): pass class Mammal(Animal): pass def newAnimal(bases=(Animal,), dict={}):...
31
by: bart | last post by:
Why is it that everybody likes the follwowing curly braces syntax function() { implementations; } I find the following much better to read (C style) function() {
39
by: Patrick | last post by:
The c# code style guide that I follow suggests that class variables (fields) be coded with camel casing, like this: int recordId; string name; It also suggests that variables within methods...
77
by: M.B | last post by:
Guys, Need some of your opinion on an oft beaten track We have an option of using "goto" in C language, but most testbooks (even K&R) advice against use of it. My personal experience was that...
1
by: RayS | last post by:
I've begun a Python module to provide a complete interface to the Meade LX200 command set, and have searched for a style/development guide for Python Lib/site-packages type modules, but only saw...
0
by: Aws | last post by:
My crazy GridView !! I am using Visual Studio 2005, I have a problem with my GridView. I have one access .mdb table and when I update a record on the table EVERYTHING is perfect. I made a Web...
4
by: Sreekanth | last post by:
Hi all, I have implemented a timing out version of fgets function call. I am pasting the entire code below. I have following doubts: 1. The code which I have written does it follow standard C...
10
by: sam_cit | last post by:
Hi Everyone, I had a doubt regarding extern decleration, i tried this is one source file, extern int sample; extern int sample; int main() {
8
by: Darren Dale | last post by:
I was just searching for some guidance on how to name packages and modules, and discovered some inconsistencies on the www.python.org. http://www.python.org/doc/essays/styleguide.html says "Module...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.