Searching for the best scripting language,

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

    #16
    Re: Searching for the best scripting language,

    Peter Hansen wrote:[color=blue]
    > I'm waiting to see anyone succeed at writing Python code that badly.
    > I'd argue that it's not possible, unless one is deliberately trying
    > to make Python look bad.[/color]

    True, Python's indenting goes a long way to discourage the one line merchants.

    Comment

    • Cameron Laird

      #17
      Re: Searching for the best scripting language,

      In article <ouGdnf9c8qBeOl DdRVn-tw@powergate.ca >,
      Peter Hansen <peter@engcorp. com> wrote:[color=blue]
      >Ryan Paul wrote:
      >[color=green]
      >> The proof is in the source. This is part of a ruby program I wrote. This
      >> snippet is actually a single 'line'. I broke it into several lines for
      >> slightly improved readability. This single line would probably take at
      >> least 15 lines to do in python, probably more if you wanted to do it
      >> intelligently.
      >>
      >> ["*.rar.*", "*.r[0-9][0-9].*"].each {|fn|
      >> Dir[$prefix+fn].collect {|x|
      >> x.gsub(/\.\d+[\d.-]*$/,"")}.uniq.e ach {|x|
      >> `cat #{sesc x}.* > #{sesc x}`} }[/color]
      >
      >This is proof of something, I'm sure, but for me it's simply another
      >indication that (a) Ruby is more like Perl than it is like Python,
      >(b) unreadable code can be written in any language, and (c) I
      >really don't mind using 15 lines to write something if it means
      >the resulting code can readily be understood.[/color]

      Comment

      • Nick Vargish

        #18
        Re: Searching for the best scripting language,

        Show me a programming environment where lines of code per minute is
        the most important coding metric, and I'll show you a place where I
        would refuse to write code.

        Do those guys come from some kind of scripting sweat shop? "Hurry it
        up, those scripts have to be on the streets of Hong Kong by Tuesday!"
        (Apologies to the Simpsons.)

        That's my feeling about the Scriptometer "practical survey". I'll
        stand by my statement if you want to substitute "terseness" for "lines
        of code per minute".

        Nick

        --
        # sigmask || 0.2 || 20030107 || public domain || feed this to a python
        print reduce(lambda x,y:x+chr(ord(y )-1),' Ojdl!Wbshjti!=o bwAcboefstobudi/psh?')

        Comment

        • Steve Lamb

          #19
          Re: Searching for the best scripting language,

          On 2004-06-13, Richard James <rmb25612@yahoo .com> wrote:[color=blue]
          > Are we looking at the scripting world through Python colored glasses?
          > Has Python development been sleeping while the world of scripting
          > languages has passed us Pythonista's by?[/color]

          Nope. This study is bogus on one large account.

          [ following lines from the 'study' ][color=blue]
          > if I have to write a script, I have to write it fast, it has to be
          > small (less typing)[/color]

          It holds as paramount the lest amount of typing possible. While there is
          a good argument that less is more, esp. when comparing something like Java vs.
          Python there is a point where that trend reverses itself. IE, 8-10 lines to
          do a "hello world" is a little too verbose. On the other hand boiling complex
          logic and processing down to a barely comprehensible mess does nothing for
          long-term stability, maintainability or, indeed, even short-term programming.

          While this guy argues that less typing means faster scripts I'd wager than
          in many cases where things are boiled into one liners more time is taken
          debugging simple to spot errors if the script were expanded out a bit. In
          short his basic premise is flawed. He starts out saying that one of the most
          important factors is typing.

          I've worked in shell and Perl. Haven't worked in Ruby yet. I still
          prefer Python because, even though I am typing a little more (actually, in
          some cases a little less[1]) I am coding faster ovarall because I'm trying to
          do it right, not tight.


          [1] In reality my Perl code was often slightly larger than my Python code
          because I refused to use certain Perlisms. My coding practice in Perl was far
          more rigid than the language allowed. This was so I could have some chance of
          being able to read and modify my code at a later date. Could I have whipped
          out tons of tight little one-liners in my Perl code and made it shorter than
          my Python code? Sure. Did I want to? Hell no.

          --
          Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
          PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
          -------------------------------+---------------------------------------------

          Comment

          • Richard James

            #20
            Re: Searching for the best scripting language,

            llothar@web.de (Lothar Scholz) wrote in message news:<6ee58e07. 0406140004.3d7c 35c4@posting.go ogle.com>...[color=blue]
            > rmb25612@yahoo. com (Richard James) wrote in message news:<2c60f0e0. 0406131234.49b4 85ec@posting.go ogle.com>...
            >[color=green]
            > > Needless to say, the Ruby site was Slashdot-ed today.[/color]
            >
            > This has nothing to do with ./
            > The site was hacked and corrupted two weeks ago and since this time
            > one a stub is online.[/color]

            This info was from an early post on comp.lang.ruby



            And it was corrected to reflect that the Ruby site is "down for
            maintenance".

            Maybe they need to use Zope? :)

            And it's /. :)

            Comment

            • Lothar Scholz

              #21
              Re: Searching for the best scripting language,

              On 14 Jun 2004 11:39:08 -0700, rmb25612@yahoo. com (Richard James)
              wrote:
              [color=blue]
              >
              >And it was corrected to reflect that the Ruby site is "down for
              >maintenance" .
              >
              >Maybe they need to use Zope? :)
              >
              >And it's /. :)[/color]

              No this posting is as wrong as yours.

              The site is down since 29. May 2004 and all data will be manually
              reviewed before the services go back online. The RAA is back since
              7.Juni 2004, the other services will follow.

              Comment

              • Richard James

                #22
                Re: Searching for the best scripting language,

                Peter Hansen <peter@engcorp. com> wrote in message news:<ouGdnf9c8 qBeOlDdRVn-tw@powergate.ca >...[color=blue]
                > Ryan Paul wrote:
                >[color=green]
                > > The proof is in the source. This is part of a ruby program I wrote. This
                > > snippet is actually a single 'line'. I broke it into several lines for
                > > slightly improved readability. This single line would probably take at
                > > least 15 lines to do in python, probably more if you wanted to do it
                > > intelligently.
                > >
                > > ["*.rar.*", "*.r[0-9][0-9].*"].each {|fn|
                > > Dir[$prefix+fn].collect {|x|
                > > x.gsub(/\.\d+[\d.-]*$/,"")}.uniq.e ach {|x|
                > > `cat #{sesc x}.* > #{sesc x}`} }[/color]
                >
                > This is proof of something, I'm sure, but for me it's simply another
                > indication that (a) Ruby is more like Perl than it is like Python,
                > (b) unreadable code can be written in any language, and (c) I
                > really don't mind using 15 lines to write something if it means
                > the resulting code can readily be understood.
                >
                > Thanks for reinforcing my lack of interest in switching to Ruby. :-)
                >
                > -Peter[/color]

                Well back in my day, in '75, "Real men" programmed in Intel binary
                machine codes without using those "sissy" Assembly language
                mnemonics...

                I think the value of maintainable code far outweighs cute one line
                coding tricks...

                And no matter how close to the hardware it made you feel, I really
                don't miss those #%$@ front panel switches! :)

                -- R.J.

                Comment

                • Peter Hansen

                  #23
                  Re: Searching for the best scripting language,

                  Richard James wrote:
                  [color=blue]
                  > Well back in my day, in '75, "Real men" programmed in Intel binary
                  > machine codes without using those "sissy" Assembly language
                  > mnemonics...[/color]

                  You used *binary*?! Ah, luxury....
                  [color=blue]
                  > I think the value of maintainable code far outweighs cute one line
                  > coding tricks...
                  >
                  > And no matter how close to the hardware it made you feel, I really
                  > don't miss those #%$@ front panel switches! :)
                  >
                  > -- R.J.[/color]

                  Comment

                  • Roy Smith

                    #24
                    Re: Searching for the best scripting language,

                    In article <9uGdnW9CBYaOal DdRVn-vA@powergate.ca >,
                    Peter Hansen <peter@engcorp. com> wrote:
                    [color=blue]
                    > Richard James wrote:
                    >[color=green]
                    > > Well back in my day, in '75, "Real men" programmed in Intel binary
                    > > machine codes without using those "sissy" Assembly language
                    > > mnemonics...[/color]
                    >
                    > You used *binary*?! Ah, luxury....[/color]

                    Yeah, right. When I started out, they only let us use zeros. You had
                    to pay your dues for a few years before they started letting you use any
                    ones.

                    Comment

                    • Carl Banks

                      #25
                      Re: Searching for the best scripting language,

                      Ryan Paul wrote:[color=blue]
                      > The proof is in the source. This is part of a ruby program I wrote. This
                      > snippet is actually a single 'line'. I broke it into several lines for
                      > slightly improved readability. This single line would probably take at
                      > least 15 lines to do in python, probably more if you wanted to do it
                      > intelligently.
                      >
                      > ["*.rar.*", "*.r[0-9][0-9].*"].each {|fn|
                      > Dir[$prefix+fn].collect {|x|
                      > x.gsub(/\.\d+[\d.-]*$/,"")}.uniq.e ach {|x|
                      > `cat #{sesc x}.* > #{sesc x}`} }[/color]


                      Oh boy. I believe this untested Python code does what you want, also
                      one line, also wrapped in the name of "clarity."

                      for f in dict([(__import__('re ').sub(r"\.\d+[\d.-]*$","",x),Non e)
                      for fn in ("*.rar.*"," *.r[0-9][0-9].*")
                      for x in __import__('glo b').glob(prefix +fn)]):
                      __import__('os' ).system("cat %s.* > %s" % (sesc(f),sesc(f )))

                      This would take about 7 lines in well-written Python, not 15.


                      bad-code-can-be-written-in-any-language-ly yr's,

                      --
                      CARL BANKS http://www.aerojockey.com/software
                      "If you believe in yourself, drink your school, stay on drugs, and
                      don't do milk, you can get work."
                      -- Parody of Mr. T from a Robert Smigel Cartoon

                      Comment

                      • Carl Banks

                        #26
                        Re: Searching for the best scripting language,

                        Cameron Laird wrote:[color=blue]
                        > In article <9hdzc.93679$DG 4.801@fe2.colum bus.rr.com>,
                        > Carl Banks <imbosol@aerojo ckey.invalid> wrote:
                        > .
                        > .
                        > .[color=green]
                        >>(Since when does Perl have an interactive interpretter?)[/color]
                        > .
                        > .
                        > .
                        > Long time <URL:
                        > http://phaseit.net/claird/comp.lang....teractive.html >.[/color]

                        Heh. It seems to me that, by the same reasoning, we could claim that
                        Python has verbose execution. Someone's obviously willing to give
                        Perl the benefit of the doubt here, but not Python. I smell
                        shenanigans.


                        --
                        CARL BANKS http://www.aerojockey.com/software
                        "If you believe in yourself, drink your school, stay on drugs, and
                        don't do milk, you can get work."
                        -- Parody of Mr. T from a Robert Smigel Cartoon

                        Comment

                        • Steve Lamb

                          #27
                          Re: Searching for the best scripting language,

                          On 2004-06-14, Carl Banks <imbosol@aerojo ckey.invalid> wrote:[color=blue]
                          > Ryan Paul wrote:[color=green]
                          >> ["*.rar.*", "*.r[0-9][0-9].*"].each {|fn|
                          >> Dir[$prefix+fn].collect {|x|
                          >> x.gsub(/\.\d+[\d.-]*$/,"")}.uniq.e ach {|x|
                          >> `cat #{sesc x}.* > #{sesc x}`} }[/color][/color]
                          [color=blue]
                          > Oh boy. I believe this untested Python code does what you want, also
                          > one line, also wrapped in the name of "clarity."[/color]
                          [color=blue]
                          > for f in dict([(__import__('re ').sub(r"\.\d+[\d.-]*$","",x),Non e)
                          > for fn in ("*.rar.*"," *.r[0-9][0-9].*")
                          > for x in __import__('glo b').glob(prefix +fn)]):
                          > __import__('os' ).system("cat %s.* > %s" % (sesc(f),sesc(f )))[/color]
                          [color=blue]
                          > This would take about 7 lines in well-written Python, not 15.[/color]
                          [color=blue]
                          > bad-code-can-be-written-in-any-language-ly yr's,[/color]

                          Ok, see, here's the thing. I look at the Ruby code and can kind of follow
                          it. I look at the Python code and can kind of follow it. but in neither case
                          have I, in glancing here and there today, been able to decipher exactly what
                          is going on. Care to show the 5 line long form to see if I get that? No
                          explination, just curious to see if I can get it reading real code instead of
                          hacked up line noise.


                          --
                          Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
                          PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
                          -------------------------------+---------------------------------------------

                          Comment

                          • Carl Banks

                            #28
                            Re: Searching for the best scripting language,

                            Steve Lamb wrote:[color=blue]
                            >
                            >
                            > On 2004-06-14, Carl Banks <imbosol@aerojo ckey.invalid> wrote:[color=green]
                            >> Ryan Paul wrote:[color=darkred]
                            >>> ["*.rar.*", "*.r[0-9][0-9].*"].each {|fn|
                            >>> Dir[$prefix+fn].collect {|x|
                            >>> x.gsub(/\.\d+[\d.-]*$/,"")}.uniq.e ach {|x|
                            >>> `cat #{sesc x}.* > #{sesc x}`} }[/color][/color]
                            >[color=green]
                            >> Oh boy. I believe this untested Python code does what you want, also
                            >> one line, also wrapped in the name of "clarity."[/color]
                            >[color=green]
                            >> for f in dict([(__import__('re ').sub(r"\.\d+[\d.-]*$","",x),Non e)
                            >> for fn in ("*.rar.*"," *.r[0-9][0-9].*")
                            >> for x in __import__('glo b').glob(prefix +fn)]):
                            >> __import__('os' ).system("cat %s.* > %s" % (sesc(f),sesc(f )))[/color]
                            >[color=green]
                            >> This would take about 7 lines in well-written Python, not 15.[/color]
                            >[color=green]
                            >> bad-code-can-be-written-in-any-language-ly yr's,[/color]
                            >
                            > Ok, see, here's the thing. I look at the Ruby code and can kind
                            > of follow it. I look at the Python code and can kind of follow it.
                            > but in neither case have I, in glancing here and there today, been
                            > able to decipher exactly what is going on. Care to show the 5 line
                            > long form to see if I get that? No explination, just curious to see
                            > if I can get it reading real code instead of hacked up line noise.[/color]

                            Of course you can.

                            import glob
                            import os
                            import re

                            f = {}
                            for pattern in ("*.rar.*"," *.r[0-9][0-9].*"):
                            for listing in glob.glob(prefi x+pattern):
                            f[listing] = None
                            for filename in f:
                            os.system("cat %s.* > %s" % (sesc(filename) ,sesc(filename) ))


                            I don't know what sesc is. I assume he had defined it elsewhere,
                            because he said this was only part of a script he wrote (and that's
                            what scares me--I can understand a throwaway one-liner looking like
                            this, but not a line in a script).


                            --
                            CARL BANKS http://www.aerojockey.com/software
                            "If you believe in yourself, drink your school, stay on drugs, and
                            don't do milk, you can get work."
                            -- Parody of Mr. T from a Robert Smigel Cartoon

                            Comment

                            • Steve Lamb

                              #29
                              Re: Searching for the best scripting language,

                              On 2004-06-14, Carl Banks <imbosol@aerojo ckey.invalid> wrote:[color=blue]
                              > Of course you can.[/color]
                              [color=blue]
                              > import glob
                              > import os
                              > import re[/color]
                              [color=blue]
                              > f = {}
                              > for pattern in ("*.rar.*"," *.r[0-9][0-9].*"):
                              > for listing in glob.glob(prefi x+pattern):
                              > f[listing] = None
                              > for filename in f:
                              > os.system("cat %s.* > %s" % (sesc(filename) ,sesc(filename) ))[/color]

                              Ah, grab anything with a rar extension and more (badly split usenet
                              binaries?) and splice them together.
                              [color=blue]
                              > I don't know what sesc is. I assume he had defined it elsewhere,[/color]

                              Stab in the darb based on the cat call as well as the purpose of this
                              snippet I would surmise "space escape". IE, escape possible spaces in the
                              file name so as not to flub the command line that hits the system call.

                              --
                              Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
                              PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
                              -------------------------------+---------------------------------------------

                              Comment

                              • Peter Hansen

                                #30
                                Re: Searching for the best scripting language,

                                Carl Banks wrote:[color=blue]
                                > Heh. It seems to me that, by the same reasoning, we could claim that
                                > Python has verbose execution. Someone's obviously willing to give
                                > Perl the benefit of the doubt here, but not Python. I smell
                                > shenanigans.[/color]

                                I tried a few Google searches, even apparently reaching the page that
                                started this thread, but I can't see what "verbose execution" might
                                mean other than (a guess) a "trace" mode which prints something for
                                every line executed as the interpreter runs. And, if that's really
                                what it is, then Python does have the capability pretty easily, via
                                sys.settrace(). (Which I'm sure Carl knows, therefore I assume my
                                guess is wrong.)

                                -Peter

                                Comment

                                Working...