Trying to choose between python and java

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

    Trying to choose between python and java

    Hi All,

    I am currently trying to decide between using python or java and have
    a few quick questions about python that you may be able to help with.

    #1 Does python have something like javas .jar packages. A jar file
    contains all the program files and you can execute the program with
    java -jar program.jar

    I am sort of hoping python has something like this because I feel it
    makes it easier to distribute between platforms e.g. linux, mac
    windows etc.

    #2 What database do people recommend for using with python that is
    easy to distribute across linux, mac, windows.

    #3 Is there any equivalent to jfreechart and jfreereport
    (http://www.jfree.org for details) in python.

    #4 If I write a program a test it with python-wxgtk2.6 under linux are
    the program windows likely to look right under windows and mac?

    #5 someone said that they used to use python but stopped because the
    language changed or made stuff depreciated (I can fully remember
    which) and old code stopped working. Is code written today likely to
    still work in 5+ years or do they depreciate stuff and you have to update?

    Anyway hopefully someone can help me out with these last few questions
    I have.

    Also does anyone else have any useful comments about python vs java
    without starting a flame war.


    --
    Kind Regards,
    Anthony Irwin



    email: anthony at above domains, - www.
  • Marc 'BlackJack' Rintsch

    #2
    Re: Trying to choose between python and java

    In <f2bghg$4q0$1@n ews-01.bur.connect. com.au>, Anthony Irwin wrote:
    #1 Does python have something like javas .jar packages. A jar file
    contains all the program files and you can execute the program with
    java -jar program.jar
    There are .egg files but usually distributing a program consisting of
    several files isn't a big problem. There is a mechanism to write a
    `setup.py` that copies the files into the correct locations. Look for
    `distutils` in the library docs.
    #2 What database do people recommend for using with python that is
    easy to distribute across linux, mac, windows.
    From Python 2.5 the standard library contains SQLite support. There are
    third party libraries to many DBMSs like MySQL, PostgreSQL, Oracle etc.

    The situation with MySQL bindings under Windows was a bit troublesome
    recently. The author of the bindings doesn't use Windows and does not
    provide pre-built binaries.
    #4 If I write a program a test it with python-wxgtk2.6 under linux are
    the program windows likely to look right under windows and mac?
    Likely yes, but you better check. Same applies to Java GUIs.
    #5 someone said that they used to use python but stopped because the
    language changed or made stuff depreciated (I can fully remember
    which) and old code stopped working. Is code written today likely to
    still work in 5+ years or do they depreciate stuff and you have to update?
    That sounds odd because the language and standard library is very
    backwards compatible. There are some things deprecated with a comment in
    the docs and in some cases runtime warnings, but the code still works.

    With Python 3.0 some things will break, because there's some cruft in the
    language and library that accumulated over time, just because backwards
    compatibility was such a high priority. The 2.x series will be supported
    for some time parallel to 3.x, so there is enough time to migrate.

    Ciao,
    Marc 'BlackJack' Rintsch

    Comment

    • Terry Reedy

      #3
      Re: Trying to choose between python and java


      "Anthony Irwin" <nospam@noemail here.nowherewro te in message
      news:f2bghg$4q0 $1@news-01.bur.connect. com.au...
      | #2 What database do people recommend for using with python that is
      | easy to distribute across linux, mac, windows.

      Check out the sqlite3 module. (But I have not used it yet).

      | #5 someone said that they used to use python but stopped because the
      | language changed or made stuff depreciated (I can fully remember
      | which) and old code stopped working. Is code written today likely to
      | still work in 5+ years or do they depreciate stuff and you have to
      update?

      Most versions of Python are still available. You are free to use and
      distribute your copies indefinitely. Several older versions are still in
      use.

      Recent releases have added features but removed very little except bugs.
      Unfortunately, bug removal sometimes breaks code. And feature additions
      occasionally introduce bugs or otherwise break code, but that is why there
      are alpha, beta, and candidate releases before a final release.

      Python3 will remove many things at once. A conversion tool is being
      written. And there is no expectation that production code should be
      immediately converted, if ever.

      Terry Jan Reedy



      Comment

      • Steven Howe

        #4
        Re: Trying to choose between python and java

        Anthony Irwin wrote:
        Hi All,
        >
        I am currently trying to decide between using python or java and have
        a few quick questions about python that you may be able to help with.
        >
        #1 Does python have something like javas .jar packages. A jar file
        contains all the program files and you can execute the program with
        java -jar program.jar
        >
        I am sort of hoping python has something like this because I feel it
        makes it easier to distribute between platforms e.g. linux, mac
        windows etc.
        >
        #2 What database do people recommend for using with python that is
        easy to distribute across linux, mac, windows.
        >
        #3 Is there any equivalent to jfreechart and jfreereport
        (http://www.jfree.org for details) in python.
        >
        #4 If I write a program a test it with python-wxgtk2.6 under linux are
        the program windows likely to look right under windows and mac?
        >
        #5 someone said that they used to use python but stopped because the
        language changed or made stuff depreciated (I can fully remember
        which) and old code stopped working. Is code written today likely to
        still work in 5+ years or do they depreciate stuff and you have to update?
        >
        Anyway hopefully someone can help me out with these last few questions
        I have.
        >
        Also does anyone else have any useful comments about python vs java
        without starting a flame war.
        >
        >
        >
        Flame war? Here amongst all the reasonable adults programmers? It never
        happens.

        1) I always thought jar files were weird. Change the run mode on you
        python script and just run it, over and over.
        chmod u+x program.py
        ../program.py
        No doubt you are (shudder) a Windows user (and beat yourself in the
        closet at night as well). No doubt Windows has a feature to set the
        privilege on a file to make it executable. With any luck, I'll never know.

        2) Python interfaces with with damn near every database I've ever seen,
        regardless if the database is on the same system or remote. At worst
        case, it seems to have ODBC connection (yes I know, C and connect are
        the same thing, like an American saying Mount Fujiyama, which is of
        course, Mount Fuji Mount) feature. Not as precise as a targeted
        connector, but it works. There are even multiple ways to 'see' the
        database. As strings, lists, objects, rows, tables and dictionaries.
        It's all quite a powerful tool. Image, getting to choose how you 'see'
        the database. Who'd have thunk!

        3) No idea about jfree. Perhaps a few keyword searchs on Google or
        Sourceforge would give you an answer.

        6) Never programmed wx. But it seems to be very stable on the programs
        I've downloaded. Anyway mapping one GUI to another is always an
        imprecise effort (especially when you have 235 patents on the product
        that you dare not tell anyone about). No two mindset ever really meet,
        especially when money is involved.

        5) All languages grow. Get over it. But, if you keep the older
        interpreter around, you can still run your old scripts. At NCR I had to
        support 6 different version of Perl because the programmers wouldn't
        fix/update their code. Seem they had better things to do and you can
        always expect the Sysadmin to save your bacon.
        But if you haven't got to that point (six version to support) yet,
        during pre-upgrade tests, you might run the program and note the
        features that are going to be decrepit. Generally you have a few minor
        version releases (year or more) before the decrepit feature is dropped.
        Then you can decide if upgrading/fix or running multiple version of
        python is the right path for you. Using the PYTHONPATH environment
        variable is a good way to redirect your older scripts to use decrepit
        feature via an older interpreter.

        The (6) you didn't ask. As a Sysadmin, I hate Java. It's a resource hog.
        Little tasks take hundreds of megabytes of RAM. What can one expect.
        It's a virtual machine inside your computer. Hog it must be! Python is a
        bit slimmer on the memory footprint and I think a hell of a lot easier
        to debug. Even strace can be used on python programs. Never got strace
        to work on Java scripts.

        The (7) you didn't ask. Last month there was a full flame war about
        java/python on the python-list. It petered out after about 15 days. You
        might review the archives to get a sense for yourself (so we don't have
        repeat the war, just for you).

        sph


        --
        HEX: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

        Comment

        • Paul Melis

          #5
          Re: Trying to choose between python and java

          Anthony Irwin wrote:
          Hi All,
          >
          I am currently trying to decide between using python or java and have a
          few quick questions about python that you may be able to help with.
          >
          #1 Does python have something like javas .jar packages. A jar file
          contains all the program files and you can execute the program with java
          -jar program.jar
          >
          I am sort of hoping python has something like this because I feel it
          makes it easier to distribute between platforms e.g. linux, mac windows
          etc.
          It depends on what you see as the benefit of jar's. If it is purely a
          matter of packing your whole application up into a single file that you
          can distribute then there are a number of tools to do that, each with
          their limits. Search for cx_freeze or py2exe (win32 only).
          #2 What database do people recommend for using with python that is easy
          to distribute across linux, mac, windows.
          You could use sqlite, which comes included with Python 2.5. The database
          files it creates are cross-platform usable and using sqlite saves you
          the trouble of having to set up a database server
          #4 If I write a program a test it with python-wxgtk2.6 under linux are
          the program windows likely to look right under windows and mac?
          Likely yes, but guaranteed no. You'll simply have to test to see how
          your program comes out on the other platforms. You could use a GUI
          toolkit that draws its own widgets instead of one that uses the native
          controls, like wxPython does. PyGTK comes to mind, not sure if it is
          available on the Mac.
          #5 someone said that they used to use python but stopped because the
          language changed or made stuff depreciated (I can fully remember which)
          and old code stopped working. Is code written today likely to still work
          in 5+ years or do they depreciate stuff and you have to update?
          The changes I can remember from the last couple of years seem to be
          mostly addition of new features to the language and more standard
          modules being included in the standard Python distribution. Of course,
          some things were deprecated, but I think actual code-breaking changes
          were not that common. But with Python 3.0 (still a long time to go)
          there will definitely be some incompatibiliti es, but a lot can probably
          be fixed automatically using an included conversion tool.

          Here's a description of the changes in the last 3 releases (2.5, 2.4,
          2.3). These span a bit more than 3 years, as 2.3.0 was released on July
          29th, 2003, with 2.5.0 on September 19th, 2006. Perhaps you can get a
          feel for the kind of changes from one release to the next.



          The official home of the Python Programming Language

          Also does anyone else have any useful comments about python vs java
          without starting a flame war.
          I guess it all depends on what you're going to use it for and what your
          goals and restrictions are. I've never seriously used Java (only a bit
          of C#), but I've been developing a GUI app with wxPython for the last
          couple of months and am pretty happy with it. Before that, I did lots of
          tooling with Python (conversion scripts, small computational stuff, etc)
          and was happy as well. So overall, I'm happy with Python :)

          It's pretty powerful for a wide variety of applications, comes with a
          large collection of modules for everything from networking to file
          compression to encryption to xml parsing to database handling to ...
          (see http://docs.python.org/lib/lib.html). I find code in Python to be
          more easily readable because of the absence of unneeded brackets and the
          fact that code that forms a block is always aligned properly (eeek,
          possible flame-war subject here). And it saves on the number of type
          strokes as well. Overall, great stuff!

          Paul

          Comment

          • Ant

            #6
            Re: Trying to choose between python and java

            On May 15, 6:30 am, Anthony Irwin <nos...@noemail here.nowherewro te:
            #1 Does python have something like javas .jar packages. A jar file
            contains all the program files and you can execute the program with
            java -jar program.jar
            As someone else has said, Python has eggs: http://peak.telecommunity.com/DevCenter/PythonEggs
            #3 Is there any equivalent to jfreechart and jfreereport
            (http://www.jfree.orgfor details) in python.
            I can't remember what it is I use - I haven't got access to my server
            at the moment... But look in the cheese shop - I'm fairly sure it was
            from there. I'll post details if I remember. Alternatively this looks
            good (though I haven't tried it and it's only free for non-commercial
            use): http://www.dislin.de
            #5 someone said that they used to use python but stopped because the
            language changed or made stuff depreciated (I can fully remember
            which) and old code stopped working. Is code written today likely to
            still work in 5+ years or do they depreciate stuff and you have to update?
            Any language will have some compatibility problems when upgrading to a
            different version, and so you have the option of updating your program
            or using an old version of the language. I'm a professional Java
            developer, and though Java 6 has been out for some time now, every
            company I've worked for in the last couple of years still uses Java
            1.4 due to problems with the upgrade.

            Python does strive however to stay backward compatible (3k not
            withstanding), and I've upgraded from 2.3 to 2.4 and now 2.5 with no
            problems.
            Also does anyone else have any useful comments about python vs java
            without starting a flame war.
            As I said, I'm a professional Java developer, and much prefer
            programming in Python when I can (and am even getting quite a lot of
            Python work at the moment via Jython :-) )

            --
            Ant...

            Notes on programming, cycling, climbing, linux and stuff.



            Comment

            • half.italian@gmail.com

              #7
              Re: Trying to choose between python and java

              >#3 Is there any equivalent to jfreechart and jfreereport
              >(http://www.jfree.org for details) in python.
              ChartDirector


              Again, not free for commercial use, but very versatile.

              ~Sean

              Comment

              • Bruno Desthuilliers

                #8
                Re: Trying to choose between python and java

                Anthony Irwin a écrit :
                Hi All,
                >
                I am currently trying to decide between using python or java and have a
                few quick questions about python that you may be able to help with.
                >
                #1 Does python have something like javas .jar packages. A jar file
                contains all the program files and you can execute the program with java
                -jar program.jar
                Python eggs
                I am sort of hoping python has something like this because I feel it
                makes it easier to distribute between platforms e.g. linux, mac windows
                etc.
                Note that while highly portable (and ported), Python is not as autistic
                as Java and doesn't try to pretend the underlying platform doesn't
                exists...
                #2 What database do people recommend for using with python that is easy
                to distribute across linux, mac, windows.
                If you're thinking of embedded databases, the answer is SQLite. Else,
                PostgreSQL and MySQL both run on Windows and mowt unices.
                #3 Is there any equivalent to jfreechart and jfreereport
                (http://www.jfree.org for details) in python.
                >
                #4 If I write a program a test it with python-wxgtk2.6 under linux are
                the program windows likely to look right under windows and mac?
                >
                #5 someone said that they used to use python but stopped because the
                language changed or made stuff depreciated
                s/depreciated/deprecated/
                (I can fully remember which)
                and old code stopped working.
                This is very strange, and even looks like FUD. Python has gone very far
                into maintaining compatibility, and there's a lot of pretty old code
                still running on latest Python versions.
                Is code written today likely to still work
                in 5+ years or do they depreciate stuff and you have to update?
                I still use code written more than five years ago.
                Anyway hopefully someone can help me out with these last few questions I
                have.
                >
                Also does anyone else have any useful comments about python vs java
                without starting a flame war.
                Err... reading the last words, I think I'd better shut my mouth now.

                Comment

                • Bruno Desthuilliers

                  #9
                  Re: Trying to choose between python and java

                  Steven Howe a écrit :
                  (snip)
                  >>
                  Flame war? Here amongst all the reasonable adults programmers? It never
                  happens.
                  >
                  Lol ! +1 QOTW

                  Comment

                  • Gabriel Genellina

                    #10
                    Re: Trying to choose between python and java

                    En Tue, 15 May 2007 05:43:36 -0300, Bruno Desthuilliers
                    <bruno.42.desth uilliers@wtf.we bsiteburo.oops. comescribió:
                    >Is code written today likely to still work
                    >in 5+ years or do they depreciate stuff and you have to update?
                    >
                    I still use code written more than five years ago.
                    Just as an example, PIL (Python Imaging Library) works unchanged with any
                    version from Python 1.5 (released 1999) till the latest 2.5 (released this
                    year)

                    --
                    Gabriel Genellina

                    Comment

                    • Nick Craig-Wood

                      #11
                      Re: Trying to choose between python and java

                      Anthony Irwin <nospam@noemail here.nowherewro te:
                      #4 If I write a program a test it with python-wxgtk2.6 under linux are
                      the program windows likely to look right under windows and mac?
                      wx adopts the native look and feel for the platform. I've used it
                      under linux and windows where it looks fine! I've never used it under
                      mac.
                      #5 someone said that they used to use python but stopped because the
                      language changed or made stuff depreciated (I can fully remember
                      which) and old code stopped working. Is code written today likely to
                      still work in 5+ years or do they depreciate stuff and you have to
                      update?
                      The language does change gently. New language features are added.
                      Backwards compatibility is deemed very important. Read PEP 5
                      "Guidelines for Language Evolution" for more info.

                      In the natural evolution of programming languages it is sometimes necessary to make changes that modify the behavior of older programs. This PEP proposes a policy for implementing these changes in a manner respectful of the installed base of Python users.


                      Libraries are deprecated but not removed. Read PEP 4 "Deprecatio n of
                      Standard Modules" if you want to know more.

                      When new modules were added to the standard Python library in the past, it was not possible to foresee whether they would still be useful in the future. Even though Python “Comes With Batteries Included”, batteries may discharge over time. Carrying ol...


                      There is more churn in the libraries which aren't distributed with
                      python.

                      There is also the Python 3000 project. The point of this project is
                      to remove the deprecated stuff and the accumulated cruft and make
                      python shiny and new again. A lot of python programs will run
                      unmodified under Python 3000 anyway. However there is a translator to
                      translate to the new Python 3000 format. Python 3000 is probably a
                      year from its first stable release. I suspect it won't be in wide use
                      for several years after that.

                      This PEP sets guidelines for Python 3000 development. Ideally, we first agree on the process, and start discussing features only after the process has been decided and specified. In practice, we’ll be discussing features and process simultaneously; of...


                      Don't be scared of Python 3000 though it is just a gentle revision of
                      the language, nothing like, lets say, going from perl 5 to perl 6.
                      Also does anyone else have any useful comments about python vs java
                      without starting a flame war.
                      You'll be a lot more productive writing python code in my experience
                      so if development time is important to you, then go with python.

                      --
                      Nick Craig-Wood <nick@craig-wood.com-- http://www.craig-wood.com/nick

                      Comment

                      • Paul Boddie

                        #12
                        Re: Trying to choose between python and java

                        On 15 May, 07:30, Anthony Irwin <nos...@noemail here.nowherewro te:
                        >
                        I am currently trying to decide between using python or java and have
                        a few quick questions about python that you may be able to help with.
                        >
                        #1 Does python have something like javas .jar packages. A jar file
                        contains all the program files and you can execute the program with
                        java -jar program.jar
                        Some people will propose Python .egg files, but I believe plain .zip
                        files containing packages may be enough for your purposes, provided
                        that there are no native code libraries inside.
                        I am sort of hoping python has something like this because I feel it
                        makes it easier to distribute between platforms e.g. linux, mac
                        windows etc.
                        See also...


                        #2 What database do people recommend for using with python that is
                        easy to distribute across linux, mac, windows.
                        See the following pages for guidance:




                        You will probably be most interested in sqlite, particularly as
                        support for that database system is now part of Python's standard
                        library (from Python 2.5 onwards), although the libraries are also
                        available separately.

                        [...]
                        #5 someone said that they used to use python but stopped because the
                        language changed or made stuff depreciated (I can fully remember
                        which) and old code stopped working. Is code written today likely to
                        still work in 5+ years or do they depreciate stuff and you have to update?
                        It's "deprecated ", not "depreciate d", by the way!

                        I tend to complain about changes in the language a lot, mostly because
                        I think that they can be confusing and off-putting for beginners, make
                        documentation and literature outdated, and distract from more
                        important areas of improvement, but I don't think that previous
                        language changes have necessarily caused me many problems. My own
                        active projects are at most around four years old, but as these
                        projects have developed, I think that language changes have been the
                        least of my problems. ;-)

                        People could use such things as an excuse to bash Python, but the
                        favourite languages of some of those people may well be undergoing
                        fundamental changes with substantial potential breakage and no
                        reasonable escape from the upgrade treadmill. Meanwhile, it's
                        completely possible to stick with a particular version of Python and
                        to write code against that without being forced to upgrade because of
                        stability issues. Indeed, Python has reached a level of maturity
                        (unlike certain competitors) where a conservative approach to version
                        adoption is completely viable: I'm using Python 2.3.x in my work, and
                        aside from a few conveniences that I miss from using Python 2.4.x
                        elsewhere, it's still very much a going concern.

                        Python 3.x will be somewhat different from Python 2.x, but people are
                        working on tools to help developers target both branches of the
                        language simultaneously, and it wouldn't surprise me if the 2.x series
                        continued in such a way that the differences between the branches get
                        smaller over time as developers gradually adopt the ways of the
                        refined 3.x language and libraries - this has been happening with Zope
                        2.x and Zope 3.x, in fact. Personally, I plan to stick with Python 2.x
                        for some time to come unless something really compelling shows up in
                        Python 3.x, and I even intend to hang on to Python 2.4.x for as long
                        as I reasonably can. There's no point in upgrading systems purely for
                        the sake of upgrading.

                        Paul

                        Comment

                        • Kirk Job Sluder

                          #13
                          Re: Trying to choose between python and java

                          Anthony Irwin <nospam@noemail here.nowherewri tes:
                          #1 Does python have something like javas .jar packages. A jar file
                          contains all the program files and you can execute the program with
                          java -jar program.jar
                          Python does this with eggs and distutils that copy your files into the
                          proper location. For os x you also have py2applet which creates an
                          application bundle that can be put onto a disk image and dragged into
                          the Applications folder. A similar utility exists for MSWin, but I've
                          not used it.
                          #2 What database do people recommend for using with python that is
                          easy to distribute across linux, mac, windows.
                          pysqlite3 for python is included in python 2.5 and can be added to
                          python 2.4. For java you would probably use HyperSonic or Derby. At
                          least one winner in the java camp for me is db4o, which is a bit like
                          shelve on steroids with an object-oriented query language.
                          #4 If I write a program a test it with python-wxgtk2.6 under linux are
                          the program windows likely to look right under windows and mac?
                          There are enough idiom differences between OS X, MSWin, Gnome and Qt
                          that native look and feel is very, very difficult to achieve. Java
                          comes close with SWT. WxPython applications seem to port badly to OS
                          X, and are tricky to build into an application bundle.

                          As a example of how these differences in idioms can become problems,
                          Mozilla Thunderbird on OS X regularly has issue with unmodified
                          keybindings. With Thunderbird 2.0 shift-J marks a message as junk,
                          even when you are entering text into a dialog box. The tkinter
                          application Leo uses the control key as a modifier on OS X rather than
                          the command key. The basic point is that you need to test on all
                          platforms you want to develop for.

                          My very biased view of the domain is as follows:
                          OS X/Cocoa: PyObjC
                          KDE + Win + OS X/X11: PyQt
                          Win + Gnome + OS X/Carbon: wxPython or Jython+SWT
                          Simple, easy, and universal: tkinter
                          Rich, complex, and universal: Jython+Swing
                          Also does anyone else have any useful comments about python vs java
                          without starting a flame war.
                          I've found it useful to use a mix of pure java and jython, although
                          I'm still working through some gotchas in regards to compiling jython
                          code that's acessible from java.
                          --
                          Kind Regards,
                          Anthony Irwin
                          >


                          email: anthony at above domains, - www.
                          --
                          Kirk Job Sluder

                          Comment

                          • sturlamolden

                            #14
                            Re: Trying to choose between python and java

                            On May 15, 7:30 am, Anthony Irwin <nos...@noemail here.nowherewro te:
                            #1 Does python have something like javas .jar packages.
                            Yes. .egg files.

                            #2 What database do people recommend for using with python that is
                            easy to distribute across linux, mac, windows.
                            Depends on your needs:

                            1. Berkely DB - not relational, zero administration, very fast
                            (bundled with Python).
                            2. SQLite - zero administration, quite fast (bundled with Python).
                            3. MySQL - relational database server, fast, GPL
                            4. Oracle - relational database server, sluggish, commercial
                            #3 Is there any equivalent to jfreechart and jfreereport
                            (http://www.jfree.orgfor details) in python.
                            Yes.

                            reportlab
                            matplotlib

                            #4 If I write a program a test it with python-wxgtk2.6 under linux are
                            the program windows likely to look right under windows and mac?
                            Yes.

                            But you should test anyway.

                            #5 someone said that they used to use python but stopped because the
                            language changed or made stuff depreciated
                            Python is no worse than Java with respect to that.


                            Comment

                            • Beliavsky

                              #15
                              Re: Trying to choose between python and java

                              On May 15, 1:30 am, Anthony Irwin <nos...@noemail here.nowherewro te:

                              <snip>
                              #5 someone said that they used to use python but stopped because the
                              language changed or made stuff depreciated (I can fully remember
                              which) and old code stopped working. Is code written today likely to
                              still work in 5+ years or do they depreciate stuff and you have to update?
                              Because Python 3 will change the syntax of print to disallow

                              print "Hello, world."

                              a substantial fraction of Python programs in existence, including all
                              of my programs, will be broken. Draw your own conclusions.

                              Comment

                              Working...