Searching for the best scripting language,

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

    #31
    Re: Searching for the best scripting language,

    In article <C7CdnQYX-bIwsFPdRVn-ig@powergate.ca >,
    Peter Hansen <peter@engcorp. com> wrote:[color=blue]
    >Carl Banks wrote:[color=green]
    >> 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.)[/color]

    Comment

    • David Eppstein

      #32
      Re: Searching for the best scripting language,

      In article <FXpzc.96175$DG 4.66965@fe2.col umbus.rr.com>,
      Carl Banks <imbosol@aerojo ckey.invalid> wrote:
      [color=blue][color=green]
      > > 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).[/color]

      As long as we're cleaning up code, how about

      import glob, os, sets
      f = Set()
      for pattern in ("*.rar.*"," *.r[0-9][0-9].*"):
      f.update(glob.g lob(prefix+patt ern))
      for filename in f:
      os.system("cat %s.* > %s" % (sesc(filename) ,sesc(filename) ))

      Now it's not even much longer than the original unreadable mess...

      --
      David Eppstein http://www.ics.uci.edu/~eppstein/
      Univ. of California, Irvine, School of Information & Computer Science

      Comment

      • Hung Jung Lu

        #33
        Re: Searching for the best scripting language,

        rmb25612@yahoo. com (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]

        Nahh... I had a friend who not only did program straight in
        hexadecimal machine code, calculated all the offsets on the fly
        without any pencil/paper/calculator, more over, very often, when we
        had bugs with a UV-EPROM, he would tell us: "guys, no need to change
        the program, see, I can just re-wire the circuit here, put a gate
        here, flip these and those switches, and done." When you can
        re-program by doing it with hardware, that's "real man". It was
        perhaps "sissy" to him to re-write programs and re-record the EPROM,
        when he could do it straight by hardware changes in a shorter amount
        of time.

        (Back then, he never forgot a single telephone number, even if he
        heard it only once. Some people are just born hardware geniuses.)

        regards,

        Hung Jung

        Comment

        • Carl Banks

          #34
          Re: Searching for the best scripting language,

          Peter Hansen wrote:[color=blue]
          > Carl Banks wrote:[color=green]
          >> 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.)[/color]


          I took it to mean the same thing you did (you might note that shell
          scripts are listed as having verbose execution, which pretty much can
          only mean that one thing).

          My point was, Perl's interactive interpretter isn't "real"; to get it,
          you have to invoke the debugger, or use a little Perl program to get
          the effect. Likewise, Python's verbose execution isn't "real"; you
          can't get it with a simple command line argument. You have to define
          a settrace function.

          Yet, they list Perl as having an interactive interpretter, by Python
          as not having verbose execution. Smells like a someone has an
          unconscious bias here.


          --
          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

          • David Eppstein

            #35
            Re: Searching for the best scripting language,

            In article <FYrzc.96743$DG 4.77631@fe2.col umbus.rr.com>,
            Carl Banks <imbosol@aerojo ckey.invalid> wrote:
            [color=blue]
            > I took it to mean the same thing you did (you might note that shell
            > scripts are listed as having verbose execution, which pretty much can
            > only mean that one thing).
            >
            > My point was, Perl's interactive interpretter isn't "real"; to get it,
            > you have to invoke the debugger, or use a little Perl program to get
            > the effect. Likewise, Python's verbose execution isn't "real"; you
            > can't get it with a simple command line argument. You have to define
            > a settrace function.
            >
            > Yet, they list Perl as having an interactive interpretter, by Python
            > as not having verbose execution. Smells like a someone has an
            > unconscious bias here.[/color]

            The command lines they used for getting an interactive interpreter are
            listed near the bottom of the page

            for perl, the line is
            perl -de 1
            and the verbose execution command is
            perl -d:Trace
            If you know of a batteries-included and similarly easy way to get
            verbose execution of some sort for Python, I suggest you send it to them
            via the email link at the top of the page -- I've found them open to
            feedback and suggestions.

            BTW, the shell script verbose execution is "sh -x".

            --
            David Eppstein http://www.ics.uci.edu/~eppstein/
            Univ. of California, Irvine, School of Information & Computer Science

            Comment

            • Reinhold Birkenfeld

              #36
              Re: Searching for the best scripting language,

              Richard James wrote:
              [color=blue]
              > Let the rabid "in defense of Python" flames begin![/color]

              Come on, folks. Just look what "language" got the most points.
              Who would not refuse to write a shellscript of more than, say, 100 lines
              (except for quoting masochists)?

              Reinhold

              --
              If a Linux distribution brought as few working software as Windows it
              would be a shame. The equivalent of Windows' "complete operating system"
              is called a rescue disk in the Linux world.
              -- David Kastrup in de.comp.os.unix .linux.misc, translated from German

              Comment

              • Carl Banks

                #37
                Re: Searching for the best scripting language,

                David Eppstein <eppstein@ics.u ci.edu> wrote in message news:<eppstein-C44C69.17103814 062004@news.ser vice.uci.edu>.. .[color=blue]
                > In article <FXpzc.96175$DG 4.66965@fe2.col umbus.rr.com>,
                > Carl Banks <imbosol@aerojo ckey.invalid> wrote:
                >[color=green][color=darkred]
                > > > 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).[/color]
                >
                > As long as we're cleaning up code, how about
                >
                > import glob, os, sets
                > f = Set()
                > for pattern in ("*.rar.*"," *.r[0-9][0-9].*"):
                > f.update(glob.g lob(prefix+patt ern))
                > for filename in f:
                > os.system("cat %s.* > %s" % (sesc(filename) ,sesc(filename) ))
                >
                > Now it's not even much longer than the original unreadable mess...[/color]

                I just noticed that I mistakenly left out the regexp in my clean code.
                Where I had f[listing] = None, I should have
                f[re.sub(r"\.\d+[\d.-]*$","",listin g)] = None, or an extra varible.


                --
                CARL BANKS

                Comment

                • David Eppstein

                  #38
                  Re: Searching for the best scripting language,

                  In article <60dfb6f6.04061 50827.6dcc5ef5@ posting.google. com>,
                  imbosol@aerojoc key.com (Carl Banks) wrote:
                  [color=blue][color=green][color=darkred]
                  > > > 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).[/color]
                  > >
                  > > As long as we're cleaning up code, how about
                  > >
                  > > import glob, os, sets
                  > > f = Set()
                  > > for pattern in ("*.rar.*"," *.r[0-9][0-9].*"):
                  > > f.update(glob.g lob(prefix+patt ern))
                  > > for filename in f:
                  > > os.system("cat %s.* > %s" % (sesc(filename) ,sesc(filename) ))
                  > >
                  > > Now it's not even much longer than the original unreadable mess...[/color]
                  >
                  > I just noticed that I mistakenly left out the regexp in my clean code.
                  > Where I had f[listing] = None, I should have
                  > f[re.sub(r"\.\d+[\d.-]*$","",listin g)] = None, or an extra varible.[/color]

                  I was wondering where the import re was supposed to be used...
                  so the line
                  f.update(glob.g lob(prefix+patt ern))
                  should become
                  for listing in glob.glob(prefi x+pattern):
                  f.add(re.sub(r" \.\d+[\d.-]*$","",listin g)
                  I guess? Not so different from what you posted, after that change...

                  As long as we're admitting to mistakes in code, I should have used
                  sets.Set instead of just Set in the second line.

                  --
                  David Eppstein http://www.ics.uci.edu/~eppstein/
                  Univ. of California, Irvine, School of Information & Computer Science

                  Comment

                  • Thorsten Kampe

                    #39
                    Re: Searching for the best scripting language,

                    * Ryan Paul (2004-06-14 02:20 +0100)[color=blue]
                    > I recently learned ruby, merely out of curiosity. Now that I know it, I
                    > dont write ANY shell utilities with python anymore. Ruby is a much better
                    > choice for almost all simple administrative tasks. For larger programs,
                    > there are times when python seems like a better choice. Python enforces
                    > consistency and readability. In an environment where many people will be
                    > working on the same code for an extended period of time, the benefits of
                    > python become apparent. That isnt to say that ruby *cant* be used in
                    > situations like that. If ruby programmers layout strict guidelines for a
                    > project regarding style and methodology, it would be just as effective.
                    >
                    > 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]

                    If you still believe in oneliners you deserve Ruby (and Perl). I
                    wouldn't want to be you if you ever have to modify your code some time
                    in the future.

                    Thorsten

                    Comment

                    • Christian Tismer

                      #40
                      Re: Searching for the best scripting language,

                      Max M wrote:
                      [color=blue]
                      > Richard James wrote:
                      >[color=green]
                      >> 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]
                      >
                      >
                      > Everyone knows that any scripting language shootout that doesn't show
                      > Python as the best language is faulty by design.[/color]

                      loveley :-)

                      --
                      Christian Tismer :^) <mailto:tismer@ stackless.com>
                      Mission Impossible 5oftware : Have a break! Take a ride on Python's
                      Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
                      14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
                      work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776
                      PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
                      whom do you want to sponsor today? http://www.stackless.com/


                      Comment

                      • Christos TZOTZIOY Georgiou

                        #41
                        Re: Searching for the best scripting language,

                        On Mon, 14 Jun 2004 11:34:18 -0400, rumours say that Peter Hansen
                        <peter@engcorp. com> might have written:
                        [color=blue]
                        >I'm waiting to see anyone succeed at writing Python code that badly.[/color]

                        This is a FAQ :)


                        --
                        TZOTZIOY, I speak England very best,
                        "Tssss!" --Brad Pitt as Achilles in unprecedented Ancient Greek

                        Comment

                        • Christos TZOTZIOY Georgiou

                          #42
                          Re: Searching for the best scripting language,

                          On Mon, 14 Jun 2004 15:20:43 -0400, rumours say that Roy Smith
                          <roy@panix.co m> might have written:
                          [color=blue]
                          >In article <9uGdnW9CBYaOal DdRVn-vA@powergate.ca >,
                          > Peter Hansen <peter@engcorp. com> wrote:
                          >[color=green]
                          >> Richard James wrote:
                          >>[color=darkred]
                          >> > 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.[/color]

                          That's nothing. After four years of intensive coding and debugging,
                          they *might* get generous enough to provide us with a power cord for the
                          machine.
                          --
                          TZOTZIOY, I speak England very best,
                          "Tssss!" --Brad Pitt as Achilles in unprecedented Ancient Greek

                          Comment

                          Working...