poll: does name conventions in python matters?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vegetax

    poll: does name conventions in python matters?

    in python it is common to see naming
    inconsistencies ,methods,module s,packages,clas ses with names in every
    posible style:
    thisisalongmeth od
    ThisIsALongMeth od
    thisIsALongMeth od
    this_is_a_long_ method
    and even This_Is_A_Long_ Method
    All over the place,even within one module!

    classic static languages dont really need naming conventions, on the other
    side dynamic languages must have it(in my opinion),since there is a lot of
    syntax variability and very short constructors, a clear example is what
    does this means?
    c = Required(2)
    is it a method which returns an object or is it a class constructor?
    this kind of situation greatly decrease readability.

    whats your opinion on the matter?

    a) dont care about naming conventions, i use the one i like
    b) didnt know python has naming conventions,nob ody follows them
    c) naming convention doesnt matters
    d) i would use one if there was a clear and concise document about python
    naming style(python style guide is vague)
    e) i think is very important for readability of source code and easier to
    use libraries
    d) other, explain please

    if you care about it,how could be fixed?

    if clear conventions were defined,would you change your current naming
    style?

    stdlib modules are not going to be touched,but for any new proyect i think
    python would benefit from an improved,well defined,strict style guide,the
    one now(http://www.python.org/doc/essays/styleguide.html) is so vague that
    is not helpfull at all.

    Ruby for example have a clear naming convention,if python had one,it would
    benefit greater than ruby,since python source code is much more readable as
    it is,but it could be better.


  • David Fraser

    #2
    Re: poll: does name conventions in python matters?

    vegetax wrote:[color=blue]
    > in python it is common to see naming
    > inconsistencies ,methods,module s,packages,clas ses with names in every
    > posible style:
    > thisisalongmeth od
    > ThisIsALongMeth od
    > thisIsALongMeth od
    > this_is_a_long_ method
    > and even This_Is_A_Long_ Method
    > All over the place,even within one module!
    >
    > classic static languages dont really need naming conventions, on the other
    > side dynamic languages must have it(in my opinion),since there is a lot of
    > syntax variability and very short constructors, a clear example is what
    > does this means?
    > c = Required(2)
    > is it a method which returns an object or is it a class constructor?
    > this kind of situation greatly decrease readability.
    >
    > whats your opinion on the matter?[/color]

    If you really worry about it, why don't you capitalise your English? :-)

    David

    Comment

    • Peter Hansen

      #3
      Re: poll: does name conventions in python matters?

      vegetax wrote:[color=blue]
      > in python it is common to see naming
      > inconsistencies ,methods,module s,packages,clas ses with names in every
      > posible style:
      > thisisalongmeth od
      > ThisIsALongMeth od
      > thisIsALongMeth od
      > this_is_a_long_ method
      > and even This_Is_A_Long_ Method
      > All over the place,even within one module![/color]

      You certainly won't find most of those in a single
      module, at least not in the standard library. You
      might find a couple. Check out the PEP(s) on the
      topic, and just follow the conventions of whatever
      code you are working with.

      If you are working with new code and need to choose
      something from scratch, go with your personal preference
      and be consistent.

      If all the above fail, use "names_like_thi s" or
      "namesLikeThis" . If you really need somebody else
      to tell you what to use: use the latter, because
      I told you to. ;-)

      -Peter

      Comment

      • vegetax

        #4
        Re: poll: does name conventions in python matters?

        Peter Hansen wrote:
        [color=blue]
        > vegetax wrote:[color=green]
        >> in python it is common to see naming
        >> inconsistencies ,methods,module s,packages,clas ses with names in every
        >> posible style:
        >> thisisalongmeth od
        >> ThisIsALongMeth od
        >> thisIsALongMeth od
        >> this_is_a_long_ method
        >> and even This_Is_A_Long_ Method
        >> All over the place,even within one module![/color]
        >
        > You certainly won't find most of those in a single
        > module, at least not in the standard library. You
        > might find a couple.[/color]

        there are some of those inconsistent cases in the stdlib,check the sys
        module which mixes a_method with amethod all over the place.
        [color=blue]
        >
        > If you are working with new code and need to choose
        > something from scratch, go with your personal preference
        > and be consistent.
        >
        > If all the above fail, use "names_like_thi s" or
        > "namesLikeThis" . If you really need somebody else
        > to tell you what to use: use the latter, because
        > I told you to. ;-)
        >
        > -Peter[/color]

        Yes sir! =)
        I actually follow the scheme you mentioned,the problem lies when you are
        using several of this libs in a module and you have to mix all kind of
        naming conventions (including yours) which makes the code less readable.



        Comment

        • Michael Hoffman

          #5
          Re: poll: does name conventions in python matters?

          Peter Hansen wrote:
          [color=blue]
          > If all the above fail, use "names_like_thi s" or
          > "namesLikeThis" . If you really need somebody else
          > to tell you what to use: use the latter, because
          > I told you to. ;-)[/color]

          No, no. Use the former, because *I* told you to. ;-)
          --
          Michael Hoffman

          Comment

          Working...