What is Python?!

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

    #1

    What is Python?!

    hi

    I'm learning python since 3 days. I' ve some programming experience in
    BASIC, Pascal, C, C++ and Java. Actually I want to add a scripting
    language to this repertoire (I have virtually no experience with
    scripting).

    Having read that python is object orientated, I start wondering if
    python is the right choice and what it is...

    a scripting language or a "normal" language like C++ etc.

    So please tell me what python is, what are it's strength, what is it
    good for and when should I use it and not one of the other languages.

    other questions:
    What about graphic? Can I create graphical interfaces with python?

    Python is interpreted but is it compiled to something like the java byte
    code or are there other ways to prevent the user to read my code?

    further hints for learning python and recommendations on books,
    tutorials, exampels, etc. are also welcome.

    thanks
  • Adriano Varoli Piazza

    #2
    Re: What is Python?!

    Robert Wierschke ha scritto:
    ....
    Reading the FAQ at the python website too difficult? I don't think you
    missed any of the most frequently asked... Good job.

    --
    Adriano Varoli Piazza
    The Inside Out: http://moranar.com.ar
    MSN: adrianomd@hotma il.com
    ICQ: 4410132

    Comment

    • Robert Wierschke

      #3
      Re: What is Python?!

      Adriano Varoli Piazza schrieb:[color=blue]
      > Robert Wierschke ha scritto:
      > ...
      > Reading the FAQ at the python website too difficult? I don't think you
      > missed any of the most frequently asked... Good job.
      >[/color]

      sorry I 've forgetten the FAQ

      Comment

      • Peter Hansen

        #4
        Re: What is Python?!

        Robert Wierschke wrote:[color=blue]
        > Having read that python is object orientated, I start wondering if
        > python is the right choice and what it is...
        >
        > a scripting language or a "normal" language like C++ etc.[/color]

        Ignore the "scripting language" label and just treat Python as a general
        purpose "normal" language like C++, Java, Ruby, and so forth. Judge a
        language by what is done with it, not by the implementation details.
        [color=blue]
        > So please tell me what python is, what are it's strength, what is it
        > good for and when should I use it and not one of the other languages.[/color]

        Easily findable with some web searching... Google is your friend.
        [color=blue]
        > Python is interpreted but is it compiled to something like the java byte
        > code or are there other ways to prevent the user to read my code?[/color]

        The simple answer is yes, it's like Java byte code, but it's Python byte
        code instead... As with any other language, relying on this to hide
        your code is inadvisable and ultimately a waste of time.

        -Peter

        Comment

        • Roy Smith

          #5
          Re: What is Python?!

          Robert Wierschke <wierob@gmx.d e> wrote:[color=blue]
          > a scripting language or a "normal" language like C++ etc.[/color]

          It is difficult to define exactly what a "scripting language" is and isn't,
          but I think most people would classify it as a scripting language.
          [color=blue]
          > So please tell me what python is, what are it's strength, what is it
          > good for and when should I use it and not one of the other languages.[/color]

          I think it's biggest strengths are that it's easy to learn and easy to use.

          There is no separate compile stage, so testing things out is quick and
          easy. The language does compile to byte code (just like Java does), but
          unlike Java, the compile stage happens completely automatically. You just
          run your program, and the system figures out if it needs to compile (or
          re-compile) your source for you.

          The ability to fire up an interactive session is key. If I'm unsure of
          something, it's usually faster to just run python and try something out
          (or, use the built-in help system, or use dir() to get a listing of all of
          an objects methods) than to look in the manual. If your interpreter was
          built properly, it's even got input editing and history built in via the
          GNU readline library.
          [color=blue]
          > What about graphic? Can I create graphical interfaces with python?[/color]

          There are several GUI libraries. I don't do that kind of work, so I'll
          leave it to others to explain them.
          [color=blue]
          > Python is interpreted but is it compiled to something like the java byte
          > code or are there other ways to prevent the user to read my code?[/color]

          It is exactly like Java. In fact, it's so close, there's a system called
          Jython, which lets you compile Java source to Python byte code. Yes, this
          means it will always be possible for users to re-create your source code
          from the byte-code object files you ship. How much of an issue this is to
          you is a business decision.

          Comment

          • phil hunt

            #6
            Re: What is Python?!

            On Wed, 10 Aug 2005 13:14:26 +0200, Robert Wierschke <wierob@gmx.d e> wrote:[color=blue]
            >hi
            >
            >I'm learning python since 3 days. I' ve some programming experience in
            >BASIC, Pascal, C, C++ and Java. Actually I want to add a scripting
            >language to this repertoire (I have virtually no experience with
            >scripting).
            >
            >Having read that python is object orientated, I start wondering if
            >python is the right choice and what it is...
            >
            > a scripting language or a "normal" language like C++ etc.[/color]

            Both.
            [color=blue]
            >So please tell me what python is, what are it's strength, what is it
            >good for and when should I use it and not one of the other languages.
            >
            >other questions:
            >What about graphic? Can I create graphical interfaces with python?[/color]

            There are several GUIs available, for example Tkinter.
            [color=blue]
            >Python is interpreted but is it compiled to something like the java byte
            >code[/color]

            Yes. It is compiled to .pyc files which are then interpreted;
            exactly the same idea that java uses.

            --
            Email: zen19725 at zen dot co dot uk


            Comment

            • bruno modulix

              #7
              Re: What is Python?!

              Roy Smith wrote:[color=blue]
              > Robert Wierschke <wierob@gmx.d e> wrote:
              >[color=green]
              >> a scripting language or a "normal" language like C++ etc.[/color]
              >
              >
              > It is difficult to define exactly what a "scripting language" is and isn't,[/color]

              You can tell buy the most common use. bash is a scripting language,
              javascript is a scripting language, perl is a scripting language, php is
              a scripting language, Python is *not* a scripting language !-)
              [color=blue]
              > but I think most people would classify it as a scripting language.[/color]

              It can be used for scripting too, yes.


              --
              bruno desthuilliers
              python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
              p in 'onurb@xiludom. gro'.split('@')])"

              Comment

              • Jason Drew

                #8
                Re: What is Python?!

                Roy Smith wrote: "there's a system called Jython, which lets you
                compile Java source to Python byte code."

                Don't you have that the wrong way 'round? From the Jython website:
                "Jython is an implementation of the high-level, dynamic,
                object-oriented language Python written in 100% Pure Java, and
                seamlessly integrated with the Java platform. It thus allows you to run
                Python on any Java platform."

                In the case of Jython you could perhaps say that Python bytecode is
                "exactly like Java". However, in the case of regular Python, it's
                closer to say that Python bytecode is much the same _idea_ as Java
                bytecode.

                Jason

                Comment

                • Roy Smith

                  #9
                  Re: What is Python?!

                  In article <1123705646.155 750.282910@g43g 2000cwa.googleg roups.com>,
                  "Jason Drew" <jasondrew72@gm ail.com> wrote:
                  [color=blue]
                  > Roy Smith wrote: "there's a system called Jython, which lets you
                  > compile Java source to Python byte code."
                  >
                  > Don't you have that the wrong way 'round?[/color]

                  Duh, of course I do! Thanks for the correction.

                  Comment

                  • Evil Bastard

                    #10
                    Re: What is Python?!

                    bruno modulix wrote:[color=blue]
                    > You can tell buy the most common use. bash is a scripting language,
                    > javascript is a scripting language, perl is a scripting language, php is
                    > a scripting language, Python is *not* a scripting language !-)[/color]

                    Perhaps a better definition - the term 'scripting language' is
                    increasingly being used by CTOs as a justification for saving money by
                    putting large chunks of their workforces on lower pay scales - an
                    attitude of 'scripters aren't as skilled as real programmers, so don't
                    deserve the same pay'.

                    To me, the term is archic. What 'scripting language' means to me is:
                    1. insufficient facilities for general purpose or 'serious' programming
                    2. ability to get simple useful programs up and working quickly
                    3. absence of a hack/compile/link/test cycle.

                    What makes 1 and 3 redundant is that linkage mechanisms have diversified
                    over the years. For instance, java and python's 'import' statements,
                    java's CLASSPATH and python's 'sys.path'.

                    I guess a language could be called a 'scripting language' if:
                    - the source code can be executed directly, and/or
                    - source need not be converted to a separate file in a
                    non-human-readable format before it can be executed, and/or
                    - a change to the source file automatically causes a change in
                    runtime behaviour

                    By these, Python is most definitely a scripting language, and joins Perl
                    and PHP. Whereas changes to java source files don't change runtime
                    behaviour.

                    OTOH, Python is also a compiled language, since it can be 'fixed' into a
                    n executable binary format.

                    --
                    Cheers
                    EB

                    --

                    One who is not a conservative by age 20 has no brain.
                    One who is not a liberal by age 40 has no heart.

                    Comment

                    • Jeff Schwab

                      #11
                      Re: What is Python?!

                      bruno modulix wrote:[color=blue]
                      > bash is a scripting language,[/color]

                      Bash is a shell. It is frequently used for scripting, but that is only
                      a secondary purpose.
                      [color=blue]
                      > javascript is a scripting language,[/color]

                      Yes, but it's a particularly specialized one.
                      [color=blue]
                      > perl is a scripting language,[/color]

                      Blasphemy! Perl is a dynamic language, entirely suitable for large
                      applications. I've written some pretty big programs entirely in Perl,
                      and extended it with C and C++ to make it fit nicely into existing
                      application frameworks.
                      [color=blue]
                      > php is a scripting language,[/color]

                      OK, but it's also awfully specialized.
                      [color=blue]
                      > Python is *not* a scripting language !-)[/color]

                      It's a scripting language, among other things. Why do you think
                      non-imported source files are not automatically compiled to pyc's?

                      Comment

                      • Dennis Lee Bieber

                        #12
                        Re: What is Python?!

                        On Thu, 11 Aug 2005 15:51:45 +1200, Evil Bastard <spam@me.please >
                        declaimed the following in comp.lang.pytho n:
                        [color=blue]
                        > To me, the term is archic. What 'scripting language' means to me is:
                        > 1. insufficient facilities for general purpose or 'serious' programming
                        > 2. ability to get simple useful programs up and working quickly[/color]

                        I fear I was spoiled by the Amiga in the late 80s, where ARexx
                        qualified as a true scripting language; since most good applications
                        included an ARexx port... (and some also included a ARexx compatible
                        function library).

                        {pseudo example -- its been over 10 years and I don't want to dig up
                        manuals to recall what the editor commands really were, so this is sort
                        of "vi"; $ is <esc>}

                        address ed
                        "3dw"
                        "iThis text is inserted$"
                        "$ZZ"
                        address command
                        "copy " file "PRT:"

                        To me, that is "scripting" -- using one program to feed commands
                        to another. Those applications that supplied a function library allowed
                        for usage closer to VBA/COM style... import the library, then call
                        functions directly.
                        --[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

                        • Grant Edwards

                          #13
                          Re: What is Python?!

                          On 2005-08-11, Dennis Lee Bieber <wlfraed@ix.net com.com> wrote:[color=blue]
                          > On Thu, 11 Aug 2005 15:51:45 +1200, Evil Bastard <spam@me.please >
                          > declaimed the following in comp.lang.pytho n:
                          >[color=green]
                          >> To me, the term is archic. What 'scripting language' means to me is:
                          >> 1. insufficient facilities for general purpose or 'serious' programming
                          >> 2. ability to get simple useful programs up and working quickly[/color]
                          >[/color]
                          [...]
                          [color=blue]
                          > To me, that is "scripting" -- using one program to feed commands
                          > to another. Those applications that supplied a function library allowed
                          > for usage closer to VBA/COM style... import the library, then call
                          > functions directly.[/color]

                          To me, a "scripting language" is one intended to "sumulate" a
                          user: a language that is used to run other programs in
                          more-or-less the same manner a normal user would. Something
                          that is intended to be used to automate a sequence of
                          operations that would otherwise be performed by a user typing or clicking
                          in a UI.

                          Bash is a scripting language. Python isn't.

                          When compared with something like bash, in Python it's not
                          particularly easy to run other programs and manipulate the
                          programs' input/output streams. It can be done, but the
                          semantics used to do so are identical to C (which nobody seems
                          to think is a scripting language).

                          Python is a general purposeprogramm ing language.

                          --
                          Grant Edwards grante Yow! Hey, I LIKE that
                          at POINT!!
                          visi.com

                          Comment

                          • phil hunt

                            #14
                            Re: What is Python?!

                            On Thu, 11 Aug 2005 15:51:45 +1200, Evil Bastard <spam@me.please > wrote:[color=blue]
                            >
                            >I guess a language could be called a 'scripting language' if:
                            > - the source code can be executed directly, and/or
                            > - source need not be converted to a separate file in a
                            > non-human-readable format before it can be executed, and/or
                            > - a change to the source file automatically causes a change in
                            > runtime behaviour
                            >
                            >By these, Python is most definitely a scripting language, and joins Perl
                            >and PHP. Whereas changes to java source files don't change runtime
                            >behaviour.[/color]

                            It wouldn't be particularly difficult to invoke Java by a shell
                            script that checks to see if source has changed and if so
                            recompiles it. If such a script became part of standard Java, would
                            Java then be a scripting language?

                            --
                            Email: zen19725 at zen dot co dot uk


                            Comment

                            • Reinhold Birkenfeld

                              #15
                              Re: What is Python?!

                              Evil Bastard wrote:[color=blue]
                              > bruno modulix wrote:[color=green]
                              >> You can tell buy the most common use. bash is a scripting language,
                              >> javascript is a scripting language, perl is a scripting language, php is
                              >> a scripting language, Python is *not* a scripting language !-)[/color]
                              >
                              > Perhaps a better definition - the term 'scripting language' is
                              > increasingly being used by CTOs as a justification for saving money by
                              > putting large chunks of their workforces on lower pay scales - an
                              > attitude of 'scripters aren't as skilled as real programmers, so don't
                              > deserve the same pay'.
                              >
                              > To me, the term is archic. What 'scripting language' means to me is:
                              > 1. insufficient facilities for general purpose or 'serious' programming
                              > 2. ability to get simple useful programs up and working quickly
                              > 3. absence of a hack/compile/link/test cycle.[/color]

                              My view too.
                              [color=blue]
                              > What makes 1 and 3 redundant is that linkage mechanisms have diversified
                              > over the years. For instance, java and python's 'import' statements,
                              > java's CLASSPATH and python's 'sys.path'.
                              >
                              > I guess a language could be called a 'scripting language' if:
                              > - the source code can be executed directly, and/or
                              > - source need not be converted to a separate file in a
                              > non-human-readable format before it can be executed, and/or
                              > - a change to the source file automatically causes a change in
                              > runtime behaviour
                              >
                              > By these, Python is most definitely a scripting language, and joins Perl
                              > and PHP. Whereas changes to java source files don't change runtime
                              > behaviour.[/color]

                              Though they prefer to be called "agile languages" nowadays.

                              Reinhold

                              Comment

                              Working...