Am I crazy regarding the style guide for function names?

Discussion in 'Python' started by Leif K-Brooks, Jun 19, 2004.

  1. 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?
     
    Leif K-Brooks, Jun 19, 2004
    #1
    1. Advertising

  2. Leif K-Brooks

    Peter Otten Guest

    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.py/python/python/nondist/peps/pep-0008.txt?r1=1.20&r2=1.24

    :)

    Peter
     
    Peter Otten, Jun 19, 2004
    #2
    1. Advertising

  3. Leif K-Brooks

    Peter Hansen Guest

    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.py/python/python/nondist/peps/pep-0008.txt?r1=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
     
    Peter Hansen, Jun 19, 2004
    #3
  4. Leif K-Brooks

    Ville Vainio Guest

    >>>>> "Peter" == Peter Hansen <> 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
     
    Ville Vainio, Jun 19, 2004
    #4
  5. 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
     
    Michael Geary, Jun 19, 2004
    #5
  6. Leif K-Brooks

    Peter Hansen Guest

    Ville Vainio wrote:

    >>>>>>"Peter" == Peter Hansen <> 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>
     
    Peter Hansen, Jun 19, 2004
    #6
  7. Leif K-Brooks

    John Roth Guest

    "Michael Geary" <> wrote in message
    news:...
    > 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
    >
    >
     
    John Roth, Jun 19, 2004
    #7
  8. Leif K-Brooks

    Dan Bishop Guest

    "Michael Geary" <> wrote in message news:<>...
    > 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.
     
    Dan Bishop, Jun 19, 2004
    #8
  9. Leif K-Brooks

    phil hunt Guest

    On Sat, 19 Jun 2004 10:05:03 -0700, Michael Geary <> 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)
     
    phil hunt, Jun 20, 2004
    #9
  10. Leif K-Brooks

    Jeff Epler Guest

    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-----
     
    Jeff Epler, Jun 23, 2004
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bert Cuzeau

    VHDL Coding Style Guide

    Bert Cuzeau, Mar 24, 2005, in forum: VHDL
    Replies:
    30
    Views:
    14,642
    lokesh_boddu
    Nov 24, 2006
  2. Ares Lagae
    Replies:
    8
    Views:
    451
    Ares Lagae
    Sep 24, 2004
  3. Christian Seberino
    Replies:
    21
    Views:
    1,680
    Stephen Horne
    Oct 27, 2003
  4. News123
    Replies:
    2
    Views:
    466
    John Machin
    Nov 26, 2008
  5. Ken Varn
    Replies:
    0
    Views:
    474
    Ken Varn
    Apr 26, 2004
Loading...

Share This Page