How does a "script" differ from a "program" or "subroutine"?

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

    How does a "script" differ from a "program" or "subroutine"?

    Ok, stupid question for the day. I'm reading the interview with Steve
    Moret and he says: "Once a lot of scripts started going in we knew
    there was no way we could back out of using Python."

    I'm just getting into Python and am wondering if I'm missing something
    or this is just a semantic issue.

    Thanks.
    -Ted

  • Phil Frost

    #2
    Re: How does a "script&qu ot; differ from a "program&q uot; or "subroutin e"?

    A subroutine is another name for "procedure" , "function", or "method".
    They are made like this:

    def fu():
    ...

    A program can contain any number of subroutines, along with classes,
    variables, etc.

    A script is just a program, but has the implication that it's a simple
    program for a simple task.

    On Mon, Aug 23, 2004 at 05:18:40PM -0700, tdi wrote:[color=blue]
    > Ok, stupid question for the day. I'm reading the interview with Steve
    > Moret and he says: "Once a lot of scripts started going in we knew
    > there was no way we could back out of using Python."
    >
    > I'm just getting into Python and am wondering if I'm missing something
    > or this is just a semantic issue.
    >
    > Thanks.
    > -Ted[/color]

    Comment

    • Porky Pig Jr

      #3
      Re: How does a "script&qu ot; differ from a "program&q uot; or "subroutin e"?

      Phil Frost <indigo@bitglue .com> wrote in message news:<mailman.2 253.1093310132. 5135.python-list@python.org >...
      [color=blue]
      > A script is just a program, but has the implication that it's a simple
      > program for a simple task.
      >[/color]

      I think the major implication is not that it's simple but it's written
      in some 'interpreted' (rather than compiled) language. so we say
      Python or Perl or Bash script, but not 'C script'. Look at the job
      openings: you'll often see something like this: 'knowledge of
      scripting languages (such as Perl and/or Python)'.

      Comment

      • Peter Hansen

        #4
        Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?

        Porky Pig Jr wrote:
        [color=blue]
        > Phil Frost <indigo@bitglue .com> wrote in message news:<mailman.2 253.1093310132. 5135.python-list@python.org >...[color=green]
        >>A script is just a program, but has the implication that it's a simple
        >>program for a simple task.
        >>[/color]
        > I think the major implication is not that it's simple but it's written
        > in some 'interpreted' (rather than compiled) language. so we say
        > Python or Perl or Bash script, but not 'C script'. Look at the job
        > openings: you'll often see something like this: 'knowledge of
        > scripting languages (such as Perl and/or Python)'.[/color]

        Before this explodes into another long thread, please check the
        archives for this newsgroup if you have any interest in this
        topic. It has been discussed at length, and both Phil's and
        Porky Pig's responses have been posted before, along with
        others (which I have a feeling we're about to see yet again
        from other people in spite of this post... ;-).

        -Peter

        Comment

        • Cameron Laird

          #5
          Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?

          In article <56cfb0e3.04082 32247.2df68078@ posting.google. com>,
          Porky Pig Jr <porky_pig_jr@m y-deja.com> wrote:[color=blue]
          >Phil Frost <indigo@bitglue .com> wrote in message
          >news:<mailman. 2253.1093310132 .5135.python-list@python.org >...
          >[color=green]
          >> A script is just a program, but has the implication that it's a simple
          >> program for a simple task.
          >>[/color]
          >
          >I think the major implication is not that it's simple but it's written
          >in some 'interpreted' (rather than compiled) language. so we say
          >Python or Perl or Bash script, but not 'C script'. Look at the job
          >openings: you'll often see something like this: 'knowledge of
          >scripting languages (such as Perl and/or Python)'.[/color]

          All true--but we also shouldn't limit ourselves to the notoriously
          imprecise dialect of employment advertisements. Let's recognize
          that's how managers and HR functionaries talk, but recognize that
          our own concepts need to be sharper.

          Comment

          • Oliver Fromme

            #6
            Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?

            tdi <ted@soleburymo untain.com> wrote:[color=blue]
            > Ok, stupid question for the day. I'm reading the interview with Steve
            > Moret and he says: "Once a lot of scripts started going in we knew
            > there was no way we could back out of using Python."
            >
            > I'm just getting into Python and am wondering if I'm missing something
            > or this is just a semantic issue.[/color]

            Historically, the term "script" means a batch job, i.e. a
            sequence of OS commands that are executed in an automated
            manner (as opposed to typing those commands interactively),
            with very limited possibilities of loops, conditionals and
            variables. DOS batch files (.BAT) are a typical example.

            The term "program" means complex processing instructions
            which implement algorithms in a particular programming
            language (which does not normally contain OS commands
            directly).

            With some languages, the differences become very small, and
            people tend to pay less attention to the distinction, so
            "scripts" and "programs" are used as synonyms. For example,
            some advanced UNIX shells (like the zsh) have features that
            support complex programming, such as various kinds of loops
            and conditionals, arrays, dictionaries etc.

            Python is more a programming language than a scripting
            language (more than Perl, at least), although you can very
            well use it for tasks which would typically be written in a
            scripting language.

            A subroutine is just another name for a procedure or a
            function, i.e. a piece of program code that performs a
            specific task, and which can be called from within the
            program (once or multiple times). You can define sub-
            routines in almost every language (both for programming
            and for scripting).

            Best regards
            Oliver

            --
            Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

            ``All that we see or seem is just a dream within a dream.''
            (E. A. Poe)

            Comment

            • Dennis Lee Bieber

              #7
              Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?

              On 24 Aug 2004 13:45:38 GMT, Oliver Fromme <olli@haluter.f romme.com>
              declaimed the following in comp.lang.pytho n:
              [color=blue]
              >
              > Python is more a programming language than a scripting
              > language (more than Perl, at least), although you can very
              > well use it for tasks which would typically be written in a
              > scripting language.
              >[/color]
              I'd put REXX at the split point between a strictly OS scripting
              language (JCL, DCL, shell scripts) and interpreted programming language
              (Python, BASIC, PERL, etc.). Primarily for REXX's easy means of using OS
              commands -- any statement not recognized as a REXX statement is
              automatically passed to the current defined command host (normally a
              command shell, but could be a REXX compatible editor, or other
              application). None of this hassle of explicitly calling os.system() (for
              example). For ambiguous statements (those that could be REXX or command
              host), putting quotes around those meant for the host was sufficient.
              [color=blue]
              > A subroutine is just another name for a procedure or a
              > function, i.e. a piece of program code that performs a
              > specific task, and which can be called from within the
              > program (once or multiple times). You can define sub-
              > routines in almost every language (both for programming
              > and for scripting).
              >[/color]
              And to confuse the matter, the old FORTRAN terminology (at
              least, in my old classes) referred to "function subprograms" and
              "subroutine subprograms".

              --[color=blue]
              > =============== =============== =============== =============== == <
              > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
              > wulfraed@dm.net | Bestiaria Support Staff <
              > =============== =============== =============== =============== == <
              > Home Page: <http://www.dm.net/~wulfraed/> <
              > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

              Comment

              • Donn Cave

                #8
                Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?

                In article <lvnmi0tq1pherg ljf3211g4dtgue9 3qhqh@4ax.com>,
                Dennis Lee Bieber <wlfraed@ix.net com.com> wrote:
                [color=blue]
                > On 24 Aug 2004 13:45:38 GMT, Oliver Fromme <olli@haluter.f romme.com>
                > declaimed the following in comp.lang.pytho n:
                >[color=green]
                > >
                > > Python is more a programming language than a scripting
                > > language (more than Perl, at least), although you can very
                > > well use it for tasks which would typically be written in a
                > > scripting language.
                > >[/color]
                > I'd put REXX at the split point between a strictly OS scripting
                > language (JCL, DCL, shell scripts) and interpreted programming language
                > (Python, BASIC, PERL, etc.). Primarily for REXX's easy means of using OS
                > commands -- any statement not recognized as a REXX statement is
                > automatically passed to the current defined command host (normally a
                > command shell, but could be a REXX compatible editor, or other
                > application). None of this hassle of explicitly calling os.system() (for
                > example). For ambiguous statements (those that could be REXX or command
                > host), putting quotes around those meant for the host was sufficient.[/color]

                And you might have added, it can be applied to other environments
                besides the OS, as an application scripting language. In either
                case it takes functionality of a type that is commonly wielded by
                hand, and exposes it in a programming language. Hence, a script,
                obviously derived from common English usage of the word.

                Donn Cave, donn@u.washingt on.edu

                Comment

                • Colin J. Williams

                  #9
                  Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?



                  Dennis Lee Bieber wrote:
                  [snip][color=blue]
                  > And to confuse the matter, the old FORTRAN terminology (at
                  > least, in my old classes) referred to "function subprograms" and
                  > "subroutine subprograms".
                  >[/color]
                  Yes, because the former returned a value, the latter did not.

                  Colin W.

                  Comment

                  • Darren Kirby

                    #10
                    Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?

                    Larry Wall said it best:
                    "A script is what you give the actors, a program is what you give the
                    audience"

                    --
                    Part of the problem since 1976


                    "...the number of UNIX installations has grown to 10, with more expected..."
                    - Dennis Ritchie and Ken Thompson, June 1972

                    Comment

                    • Dennis Lee Bieber

                      #11
                      Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?

                      On Tue, 24 Aug 2004 09:22:18 -0700, Donn Cave <donn@u.washing ton.edu>
                      declaimed the following in comp.lang.pytho n:
                      [color=blue][color=green]
                      > > automatically passed to the current defined command host (normally a
                      > > command shell, but could be a REXX compatible editor, or other[/color][/color]

                      <snip>
                      [color=blue]
                      > And you might have added, it can be applied to other environments
                      > besides the OS, as an application scripting language. In either[/color]

                      I thought I had, though the use of "defined command host" may
                      have been obscure. <G>


                      --[color=blue]
                      > =============== =============== =============== =============== == <
                      > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
                      > wulfraed@dm.net | Bestiaria Support Staff <
                      > =============== =============== =============== =============== == <
                      > Home Page: <http://www.dm.net/~wulfraed/> <
                      > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

                      Comment

                      • Greg Ewing

                        #12
                        Re: How does a &quot;script&qu ot; differ from a &quot;program&q uot; or &quot;subroutin e&quot;?

                        Porky Pig Jr wrote:[color=blue]
                        > Phil Frost <indigo@bitglue .com> wrote in message news:<mailman.2 253.1093310132. 5135.python-list@python.org >...
                        >[color=green]
                        >> A script is just a program, but has the implication that it's a simple
                        >> program for a simple task.[/color]
                        >
                        > I think the major implication is not that it's simple but it's written
                        > in some 'interpreted' (rather than compiled) language.[/color]

                        To my way of thinking, a "script" is a canned sequence of
                        commands for something that one normally uses interactively.
                        On that basis, python "scripts" aren't really scripts, they're
                        programs -- because the Python interpreter isn't normally
                        used interactively, except for trying things out during
                        programming.

                        --
                        Greg Ewing, Computer Science Dept,
                        University of Canterbury,
                        Christchurch, New Zealand


                        Comment

                        Working...