Am I crazy regarding the style guide for function names?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leif K-Brooks

    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_u nderscores for everything, but it claims to
    be last updated in 2001. Am I crazy?
  • Peter Otten

    #2
    Re: Am I crazy regarding the style guide for function names?

    Leif K-Brooks wrote:
    [color=blue]
    > 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_u nderscores for everything, but it claims to
    > be last updated in 2001. Am I crazy?[/color]

    Not yet, according to

    Download Python for free. The Python programming language, an object-oriented scripting and rapid application development language. You can download it from http://www.python.org/download


    :-)

    Peter

    Comment

    • Peter Hansen

      #3
      Re: Am I crazy regarding the style guide for function names?

      Peter Otten wrote:
      [color=blue]
      > Leif K-Brooks wrote:
      >
      >[color=green]
      >>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_wi th_underscores for rarely-used utility functions. Now it
      >>says to use low_case_with_u nderscores for everything, but it claims to
      >>be last updated in 2001. Am I crazy?[/color]
      >
      >
      > Not yet, according to
      >
      > http://cvs.sourceforge.net/viewcvs.p...1=1.20&r2=1.24
      >
      > :-)[/color]

      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

      Comment

      • Ville Vainio

        #4
        Re: Am I crazy regarding the style guide for function names?

        >>>>> "Peter" == Peter Hansen <peter@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

        Comment

        • Michael Geary

          #5
          Re: Am I crazy regarding the style guide for function names?

          Peter Hansen wrote:[color=blue]
          > 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? ;-)[/color]

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

          ClassesLikeThis and methods_like_th is sounds like a way to make everybody
          unhappy: people who hate MixedCase and people who hate
          names_with_unde rscores.

          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


          Comment

          • Peter Hansen

            #6
            Re: Am I crazy regarding the style guide for function names?

            Ville Vainio wrote:
            [color=blue][color=green][color=darkred]
            >>>>>>"Peter" == Peter Hansen <peter@engcorp. com> writes:[/color][/color]
            >
            > 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?[/color]

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

            Comment

            • John Roth

              #7
              Re: Am I crazy regarding the style guide for function names?

              "Michael Geary" <Mike@DeleteThi s.Geary.com> wrote in message
              news:10d8shvsq0 1auf0@corp.supe rnews.com...[color=blue]
              > Peter Hansen wrote:[color=green]
              > > 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? ;-)[/color]
              >
              > I'm glad I'm not the only one. :-)
              >
              > ClassesLikeThis and methods_like_th is sounds like a way to make everybody
              > unhappy: people who hate MixedCase and people who hate
              > names_with_unde rscores.
              >
              > Ruby uses exactly this same convention. I have no idea why.
              >
              > Myself, I'm sticking with ClassesLikeThis and methodsLikeThis for my[/color]
              Python[color=blue]
              > and Ruby code. (I don't like underscores at all!)[/color]

              Likewise.

              John Roth[color=blue]
              >
              > -Mike
              >
              >[/color]


              Comment

              • Dan Bishop

                #8
                Re: Am I crazy regarding the style guide for function names?

                "Michael Geary" <Mike@DeleteThi s.Geary.com> wrote in message news:<10d8shvsq 01auf0@corp.sup ernews.com>...[color=blue]
                > Peter Hansen wrote:[color=green]
                > > 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? ;-)[/color]
                >
                > I'm glad I'm not the only one. :-)
                >
                > ClassesLikeThis and methods_like_th is sounds like a way to make everybody
                > unhappy: people who hate MixedCase and people who hate
                > names_with_unde rscores.[/color]

                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.
                [color=blue]
                > Myself, I'm sticking with ClassesLikeThis and methodsLikeThis for my Python
                > and Ruby code. (I don't like underscores at all!)[/color]

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

                Comment

                • phil hunt

                  #9
                  Re: Am I crazy regarding the style guide for function names?

                  On Sat, 19 Jun 2004 10:05:03 -0700, Michael Geary <Mike@DeleteThi s.Geary.com> wrote:[color=blue]
                  >Peter Hansen wrote:[color=green]
                  >> 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? ;-)[/color]
                  >
                  >I'm glad I'm not the only one. :-)
                  >
                  >ClassesLikeThi s and methods_like_th is sounds like a way to make everybody
                  >unhappy: people who hate MixedCase and people who hate
                  >names_with_und erscores.
                  >
                  >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!)[/color]

                  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)


                  Comment

                  • Jeff Epler

                    #10
                    Re: Am I crazy regarding the style guide for function names?

                    The PEP has been updated more recently than this.

                    You can view the history of the PEP here:
                    Download Python for free. The Python programming language, an object-oriented scripting and rapid application development language. You can download it from http://www.python.org/download


                    The change you're talking about was probably made last September:
                    Download Python for free. The Python programming language, an object-oriented scripting and rapid application development language. You can download it from http://www.python.org/download


                    Jeff

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

                    iD8DBQFA2XZ7Jd0 1MZaTXX0RAgOZAJ 9H66ya4kvCfU6Le lPJK15u2beYoQCd EtpU
                    m/CfvOUUiKtMdLXNE uGW3XE=
                    =OjAB
                    -----END PGP SIGNATURE-----

                    Comment

                    Working...