Double underscores -- ugly?

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

    #16
    Re: Double underscores -- ugly?

    Jason a écrit :
    (snip)
    Hmm. I must be the only person who doesn't think the double
    underscores are ugly.
    As far as I'm concerned, I just don't care if they are "ugly" or not -
    FWIW, I never ever think of them in terms of "beauty" or "ugliness".

    What I do care about is that they simply and clearly convey a special
    meaning (just like the _single_leading _underscore names), and make sure
    you won't accidentaly override such a name.



    Comment

    • Bruno Desthuilliers

      #17
      Re: Double underscores -- ugly?

      benhoyt a écrit :
      (snip)
      Then again, what's stopping us just using a single leading underscore?
      Nobody calls their own private methods _init or _add
      I do.

      Comment

      • cokofreedom@gmail.com

        #18
        Re: Double underscores -- ugly?

        So people's problem with __word__ is that it is not very readable?

        How so, it stands out on page, it clearly is different from other
        objects and doesn't abuse other symbols that generally have a meaning
        based on their use.

        I haven't seen a single alternative that really stands out as much as
        __word__ does.

        Comment

        • Ben Finney

          #19
          Re: Double underscores -- ugly?

          cokofreedom@gma il.com writes:
          So people's problem with __word__ is that it is not very readable?
          No, the complaint seems to be that it's "ugly".

          --
          \ "[T]he speed of response of the internet will re-introduce us |
          `\ to that from which our political systems have separated us for |
          _o__) so long, the consequences of our own actions." -- Douglas Adams |
          Ben Finney

          Comment

          • Steven D'Aprano

            #20
            Re: Double underscores -- ugly?

            On Wed, 20 Feb 2008 03:12:39 -0800, cokofreedom wrote:
            So people's problem with __word__ is that it is not very readable?
            >
            How so, it stands out on page, it clearly is different from other
            objects and doesn't abuse other symbols that generally have a meaning
            based on their use.
            >
            I haven't seen a single alternative that really stands out as much as
            __word__ does.
            My only two gripes about double underscore names are that:

            (1) My news reader interprets _X_ as "underline X", which leads to ugly
            display. I could turn that feature off, but that would mean losing *X*
            "bold X", which I like.

            (2) Two underscores __ is insufficiently visually different from a single
            underscore _. Choosing a good font reduces the problem, but doesn't make
            it go away.

            However, these are minor gripes. On a scale of 0 to -9, where 0 is "it
            doesn't upset me or please me at all" and -9 is "I'd rather die than live
            with this one more minute", these gripes are both about a -2, and far out-
            weighed by the advantages. Taking the advantages and the disadvantages
            both into account, I give it a total score of about +4.



            --
            Steven

            Comment

            • castironpi@gmail.com

              #21
              Re: Replacing 'if __name__ == __main__' with decorator (was: Doubleunderscor es -- ugly?)

              @mainmethod
              def main(...)
              >
              and like this:
              >
              @mainmethod(par ser=myparser)
              def main(...)
              >
              then you cannot use that decorator for a function that expects or
              allows a function as its first argument? Because how and
              If it's called with only one non-keyword parameter, then the language
              might have done it; if not, guaranteed not. (More succintly, if it's
              not, the language didn't.)

              So, to get:
              @mainmethod
              def main(...)
              you'll have to check the parameter counts, and you can never invoke
              with just one callable parameter, pretty easy; bulky; your choice
              between:

              @mainmethod()
              def main(...)

              Note: 'Non-keyword' -and- callable!

              Comment

              Working...