Why Python?

Discussion in 'Python' started by Ben Finney, Mar 1, 2004.

  1. Ben Finney

    Ben Finney Guest

    On Mon, 01 Mar 2004 02:11:46 GMT, Todd7 wrote:
    > I am looking at learning Python, but I would like to know what its
    > strengths and weaknesses are before I invest much time in learning it.


    A Google search that should be helpful:

    <http://www.google.com/search?q=%22why+python%22>

    --
    \ "A politician is an animal which can sit on a fence and yet |
    `\ keep both ears to the ground." -- Henry L. Mencken |
    _o__) |
    Ben Finney <http://bignose.squidly.org/>
    Ben Finney, Mar 1, 2004
    #1
    1. Advertising

  2. Ben Finney

    Todd7 Guest

    I am looking at learning Python, but I would like to know what its
    strengths and weaknesses are before I invest much time in learning it. My
    first thought is what is it good for programming, however I expect an
    answer from the python newsgroup to be something like "everything". So
    maybe a better question is what type of programming projects is Python a
    bad choice?

    What makes it better or worse than languages like perl, php, delphi, or
    c++?

    Thanks for your opinions.

    Todd.
    Todd7, Mar 1, 2004
    #2
    1. Advertising

  3. > I am looking at learning Python, but I would like to know what its
    > strengths and weaknesses are before I invest much time in learning it.


    All of the other answers above are good. I would say the followng:

    * Python is easy to learn. I learned it in an afternoon -- that's an
    experienced programmer. It's ideal for a beginner as well.
    * Good cross platform support both windows and linux. Never re-write
    code again. Also writes very fast to begin with--good RAD tool.
    * To write just about anything all you need to know is python, C/C++,
    and a little JavaScript if you want to make web pages. That's it.
    Python has a huge application range--small scripts, full up
    applications, cgi scripting for the web. You can even integrate it with
    the Mozilla platform for local cgi like functions.

    What's not good in python:

    * If speed is more important than coding time use C/C++ instead.
    * If you want to obscruate your code maybe a compiled langague is better.

    Rob
    Robert M. Emmons, Mar 1, 2004
    #3
  4. Ben Finney

    John Hunter Guest

    >>>>> "Todd7" == Todd7 <> writes:

    Todd7> What makes it better or worse than languages like perl,
    Todd7> php, delphi, or c++?

    perl - both python and perl have many, many external modules written
    for them. perl *may* have more. Some people like that perl has CPAN,
    a central repository for modules. In my opinion, this is not so
    important now that we have google. python is object oriented in its
    bones; with perl, OO is a hack. python favors a clean, simple,
    obvious syntax, perl embraces "there is more that one way to do it."
    For this reason, most python coders feel that python code is easier to
    read and maintain.

    php - widely used for web development and has a lot of nice packages
    in this niche - bulletin boards, database interfaces, and so on.
    python will have packages for each of these areas, but they are not as
    widely used and are not industry standard, in the way for example that
    phymyadmin is. php is not as powerful a programming language as
    python is and is not widely used outside the sphere of web
    development. See the recent thread
    http://groups.google.com/groups?hl=...python*&hl=en&lr=&ie=UTF-8&oe=UTF-8&scoring=d

    c++ - a big, powerful, complex language. Good for designing complex
    software packages and code where performance is important. Makes
    things like file IO, dbase and web connectivity harder than they need
    to be. Many who use python favor a mixed language programming style:
    use python for most everything, and write (or reuse) C/C++/FORTRAN
    extensions for processor/performance intensive parts. There are many
    good tools (SWIG, F2Py, boost::python, etc) for automating the process
    of creating python extensions of code from these other languages. If
    you need high performance code, it's good to know how to write code in
    at least one of these compiled languages.

    My advice: learn python first. The community is very friendly and
    receptive to newcomers (you won't find this on perl or C++
    newsgroups). You'll get advice from world experts on coding and
    style. python coders value elegant, readable, efficient, well written
    code and will give you lots of advice along these lines.

    JDH
    John Hunter, Mar 1, 2004
    #4
  5. Ben Finney

    Qp Guest

    Well, I'm new at it (started about 2 months ago in preparation for senior
    design project), and the one thing I've seen that could be better is overall
    documentation; sometimes it is hard to find what you're looking for
    (especially in libraries like Tkinter for GUI programming and Twisted for
    network programming). It's possible, just hard.

    The good things I've noticed? Well, to do what I've done so far in Java
    would have taken at least 5 and probably more like 10 times the code I've
    written. A simple yet decent TCP chat server in about 30 lines of code is
    something I never considered possible before looking at Python.

    "Todd7" <> wrote in message
    news:Xns949ECD7289AD6Todd7Nospampleasecom@68.12.19.6...
    > I am looking at learning Python, but I would like to know what its
    > strengths and weaknesses are before I invest much time in learning it. My
    > first thought is what is it good for programming, however I expect an
    > answer from the python newsgroup to be something like "everything". So
    > maybe a better question is what type of programming projects is Python a
    > bad choice?
    >
    > What makes it better or worse than languages like perl, php, delphi, or
    > c++?
    >
    > Thanks for your opinions.
    >
    > Todd.
    Qp, Mar 1, 2004
    #5
  6. Ben Finney

    Todd7 Guest

    Thanks for all the well reasoned replies. I think I will make the
    plunge.





    Todd7 <> wrote in
    news:Xns949ECD7289AD6Todd7Nospampleasecom@68.12.19.6:

    > I am looking at learning Python, but I would like to know what its
    > strengths and weaknesses are before I invest much time in learning it.
    > My first thought is what is it good for programming, however I expect
    > an answer from the python newsgroup to be something like "everything".
    > So maybe a better question is what type of programming projects is
    > Python a bad choice?
    >
    > What makes it better or worse than languages like perl, php, delphi,
    > or c++?
    >
    > Thanks for your opinions.
    >
    > Todd.
    >
    Todd7, Mar 1, 2004
    #6
  7. Ben Finney

    Rainer Deyke Guest

    Todd7 wrote:
    > What makes it better or worse than languages like perl, php, delphi,
    > or c++?


    I'll focus on the weaknesses of Python instead of the strengths.

    1. Computation intense Python programs tend to be slower than optimized
    equivalent programs written in languages that compile to native code.

    2. Python programs are somewhat difficult to distribute compared to programs
    in languages that compile to native code.

    3. Some other languages make it easier to detect certain classes of errors
    in your code. With a few exceptions, errors in Python code can only be
    found by actually running the code or by checking by hand.

    4. Python is only somewhat flexible about allowing you to customize the
    language from within the language. You can define new functions and new
    data types, but no new operators, no new control structures, nor any type of
    new syntax. If you need to define a domain-specific language within your
    program, Python may not be your best choice.


    --
    Rainer Deyke - - http://eldwood.com
    Rainer Deyke, Mar 1, 2004
    #7
  8. Ben Finney

    Ed Murphy Guest

    On Mon, 01 Mar 2004 05:12:48 +0000, Rainer Deyke wrote:

    > Todd7 wrote:


    >> What makes it better or worse than languages like perl, php, delphi,
    >> or c++?


    > I'll focus on the weaknesses of Python instead of the strengths.

    [snip]
    > 2. Python programs are somewhat difficult to distribute compared to
    > programs in languages that compile to native code.


    How do you figure this one? Something to do with statically linked
    libraries? (I'm a Python newbie, but have been programming in general
    for almost 20 years, about half of that professionally.)
    Ed Murphy, Mar 1, 2004
    #8
  9. Ben Finney

    Rainer Deyke Guest

    Ed Murphy wrote:
    > On Mon, 01 Mar 2004 05:12:48 +0000, Rainer Deyke wrote:
    >> 2. Python programs are somewhat difficult to distribute compared to
    >> programs in languages that compile to native code.

    >
    > How do you figure this one? Something to do with statically linked
    > libraries? (I'm a Python newbie, but have been programming in general
    > for almost 20 years, about half of that professionally.)


    Basically you have to distribute the Python interpreter along with your
    program, since you generally can't rely on the end user having (the correct
    version of) Python installed.


    --
    Rainer Deyke - - http://eldwood.com
    Rainer Deyke, Mar 1, 2004
    #9
  10. Ben Finney

    Michael Guest


    >>>2. Python programs are somewhat difficult to distribute compared to
    >>>programs in languages that compile to native code.
    >>>
    >>>

    >>How do you figure this one? Something to do with statically linked
    >>libraries? (I'm a Python newbie, but have been programming in general
    >>for almost 20 years, about half of that professionally.)
    >>
    >>

    >
    >Basically you have to distribute the Python interpreter along with your
    >program, since you generally can't rely on the end user having (the correct
    >version of) Python installed.
    >

    It's really no harder a dependency to check than for shared libraries or
    such with C programs.
    Michael, Mar 1, 2004
    #10
  11. Ben Finney

    Paul McGuire Guest

    "Rainer Deyke" <> wrote in message
    news:l6C0c.8261$ko6.195399@attbi_s02...
    > Ed Murphy wrote:
    > > On Mon, 01 Mar 2004 05:12:48 +0000, Rainer Deyke wrote:
    > >> 2. Python programs are somewhat difficult to distribute compared to
    > >> programs in languages that compile to native code.

    > >
    > > How do you figure this one? Something to do with statically linked
    > > libraries? (I'm a Python newbie, but have been programming in general
    > > for almost 20 years, about half of that professionally.)

    >
    > Basically you have to distribute the Python interpreter along with your
    > program, since you generally can't rely on the end user having (the

    correct
    > version of) Python installed.
    >

    Utilities such as py2exe and McMillan Installer make this problem much
    simpler. Real-world example: I needed to provide a customer with a *very*
    simple HTTP server for centrally serving up a global configuration file. My
    prototype was 2 lines of Python code (actual finished version was about 50
    lines, including some signal handling), used McInstaller to create a
    free-standing distributable .EXE file (that fit on a 3-1/2" floppy!). Very
    portable, does not require Python to be installed on the target platform.

    -- Paul
    Paul McGuire, Mar 1, 2004
    #11
  12. Ben Finney

    Mark Carter Guest

    > What makes it better or worse than languages like

    Python has loads of modules, which are easy to install.

    Python has good documentation, with useful examples.


    I'm trying to learn Scheme at the moment, to broaden my programming
    horizon. I am generally finding it an uphill struggle. Scheme might be
    a theoretically better language design, but in Python you can just get
    on and do it.

    Someone once suggested that the fact that Python had a Benevolent
    Dictator For Life is a possible positive on its popularity, and I
    think that the suggestion has merit. Effort has been made to make it
    accessable to the ordinary programmer.

    To give just one example ...

    Regular expressions.

    MIT Scheme explains its REXP abstraction: "In addition to providing
    standard regular-expression support, MIT Scheme also provides the REXP
    abstraction. ". But it doesn't give any examples. And I couldn't find
    any by Googling, either.

    Now look at Python. Section 4.2.1 (Regular Expression Syntax) kindly
    reminds us of the regexp syntax - something that MIT does not. Section
    4.2.2 and 4.2.6 then goes on to give us some regexp examples.


    Python is popular because it tries to be popular. Scheme seems more
    academic, with a more "why would you want a GUI anyway?" type
    attitude.
    Mark Carter, Mar 1, 2004
    #12
  13. In article <>,
    Robert M. Emmons <> wrote:
    .
    [apt comments]
    .
    .
    >What's not good in python:
    >
    >* If speed is more important than coding time use C/C++ instead.
    >* If you want to obscruate your code maybe a compiled langague is better.
    >
    >Rob


    Note the availability of pyobfuscate <URL:
    http://www.lysator.liu.se/~astrand/projects/pyobfuscate/ >.

    Myself, in the absence of more details, I advise people for
    whom speed is important to work in Python--but be prepared
    to combine it with C coding (or even assembler! I've been
    experimenting lately ...).
    --

    Cameron Laird <>
    Business: http://www.Phaseit.net
    Cameron Laird, Mar 1, 2004
    #13
  14. Ben Finney

    Nobody Guest

    "Todd7" <> wrote in message
    news:Xns949ECD7289AD6Todd7Nospampleasecom@68.12.19.6...
    > I am looking at learning Python, but I would like to know what its
    > strengths and weaknesses are before I invest much time in learning it. My
    > first thought is what is it good for programming, however I expect an
    > answer from the python newsgroup to be something like "everything". So
    > maybe a better question is what type of programming projects is Python a
    > bad choice?
    >
    > What makes it better or worse than languages like perl, php, delphi, or
    > c++?
    >
    > Thanks for your opinions.
    >
    > Todd.
    >





    Why NOT Python?
    I'm a noob at it, but so far I love it. It's easy to put together a program
    pretty quickly using it. Also, even when I have to code something up in, say
    C++, I can still put together a prototype in Python first to get a better
    understanding of the problem space. (Ya have to "...throw one away..."
    anyway, so why not use Python first?)
    I know this doesn't _directly_ answer your question, but it does in a way.


    WR
    Nobody, Mar 1, 2004
    #14
  15. > 3. Some other languages make it easier to detect certain classes of errors
    > in your code. With a few exceptions, errors in Python code can only be
    > found by actually running the code or by checking by hand.


    True maybe, but I would argue that Python is not suseptable to many if
    not most of the errors generated and found in say C/C++ coding. You
    also have a dramatic code volume reduction which helps too.

    There are static code checkers too for python which can help some too.

    I personally think that python has it as a whole on debugging -- i.e.
    pretty much the lack of a need to do much sophisticated debugging.

    It's not clear to me what kind of error that a C compiler can catch
    that's difficult to deal with in Python (although I'm sure there are
    some). IMHO the whole reason C/C++ has sophisticated debugging tools is
    that code debugging in C is a nightmare.

    Thanks for the info--I enjoyed your comments and other's replies to them.

    Take care.
    Rob
    Robert M. Emmons, Mar 1, 2004
    #15
  16. Robert M. Emmons wrote:
    > IMHO the whole reason C/C++ has sophisticated debugging tools is
    > that code debugging in C is a nightmare.


    That's my opinion as well.

    One debugging feature that Python doesn't support is "edit-while-debugging" (edit
    the function/method) you just debug, something which is possible in VB and VC6,
    for example) I think it'd not be *that* hard implementing it. Maybe a Python IDE
    vendor will implement it some day.

    -- Gerhard
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=, Mar 1, 2004
    #16
  17. Ben Finney

    Wayne Folta Guest

    everything

    But you were expecting that.

    How about

    everything in every way in all situations

    The bottom line is python is a clear, powerful language that has a
    great culture. You have a choice:

    1. You want to learn the "perfect" language for each project at hand.
    Even if you're good at learning new languages -- as I think I am --
    it's still going to take you a while to be idiomatic in the language
    instead of, say, programming perl in python.

    Not to mention that finding the "perfect" language can take quite some
    time for each project. You'll have language advocates on each side of
    the issue. Is this project a natural fit for lisp? Oh, no, ruby's much
    more practical for this. Yes, but foobar has a package for doing
    exactly what you want. Blah, blah...

    2. Learn a general-purpose language that can be easily used with many
    different paradigms (OO, functional, etc), has a good library set
    (network, math, etc), and has a flexible culture. This language should
    be reasonably well-known so you can find it widely, can find books on
    it, etc.

    Some might say that perl 6 will be the epitome of #2, though my opinion
    is that perl will manage to implement #1 in a single language.

    If you want to go with option #2, python's at the top of the list, in
    my opinion.

    (Actually, there is a #3: you want to be highly marketable. Depending
    on where you want to work, the language de jour is likely to be C++,
    Java, or Visual Basic.)
    Wayne Folta, Mar 1, 2004
    #17
  18. Ben Finney

    Bob Ippolito Guest

    On 2004-03-01 09:02:01 -0500, (Cameron Laird) said:

    > In article <>,
    > Robert M. Emmons <> wrote:
    > .
    > [apt comments]
    > .
    > .
    >> What's not good in python:
    >>
    >> * If speed is more important than coding time use C/C++ instead.
    >> * If you want to obscruate your code maybe a compiled langague is better.
    >>
    >> Rob

    >
    > Note the availability of pyobfuscate <URL:
    > http://www.lysator.liu.se/~astrand/projects/pyobfuscate/ >.
    >
    > Myself, in the absence of more details, I advise people for
    > whom speed is important to work in Python--but be prepared
    > to combine it with C coding (or even assembler! I've been
    > experimenting lately ...).


    One thing to note is that it is *reasonable* to combine C, C++,
    assembly, etc with Python because the Python API is consistent and
    understandable, and doesn't require a confusing "precompiler" (though,
    Pyrex is a great one).

    -bob
    Bob Ippolito, Mar 1, 2004
    #18
  19. Gerhard Häring <> writes:

    > One debugging feature that Python doesn't support is
    > "edit-while-debugging" (edit the function/method) you just debug,
    > something which is possible in VB and VC6, for example)


    Sorry ... what do you mean by "edit while debugging" ?

    Something like XCode's "fix-n-continue" ?

    In other words the ability to redefine a function in a running program
    (possibly even before the stack has been unwound after an error (or
    breakpoint) was encountered) ?

    [Something which has been an inherent part of the language in many
    members of the Lisp family for decades, BTW]

    If you forget about not unwinding the stack, Python certainly supports
    this.

    Now, how would one prevent stack unwiding when an exception is raised
    .... in order to allow the user to inspect the stack frames navigate
    them, redifine any functions, and then allow continuation?

    [I guess I could find the answer in the pdb source.]
    Jacek Generowicz, Mar 2, 2004
    #19
  20. > Gerhard Häring wrote:
    > > One debugging feature that Python doesn't support is
    > > "edit-while-debugging" (edit the function/method) you
    > > just debug, something which is possible in VB and VC6,
    > > for example)


    Jacek Generowicz wrote:
    > Sorry ... what do you mean by "edit while debugging" ?


    You can set a breakpoint in a function, and while stopped at that breakpoint
    you can edit the code in that same function. Then, you can continue
    execution and it will execute your new code.

    As much as I dislike C++, Visual Studio's Edit and Continue feature is a
    huge benefit. I often write the skeleton of a function, start the program
    and trace into the function, and then write the code right there with the
    program running, with live data to test while coding.

    You can also change the execution pointer while stopped at a breakpoint. So
    you can write some code and test it, and then if you want to change the code
    and test it again, just move the execution pointer back to the beginning of
    your code.

    -Mike
    Michael Geary, Mar 2, 2004
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VGltOjouLg==?=

    Why, why, why???

    =?Utf-8?B?VGltOjouLg==?=, Jan 27, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    551
    Juan T. Llibre
    Jan 27, 2005
  2. Horace Nunley

    why why why does function not work

    Horace Nunley, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    450
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 27, 2006
  3. Mr. SweatyFinger

    VWD why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    370
    =?Utf-8?B?Q2lhcmFuIE8nJycnRG9ubmVsbA==?=
    Dec 21, 2006
  4. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    862
    Mark Rae
    Dec 21, 2006
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,762
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page