FAQ
hi,

some of my friends told that python and java are similar in the idea of
platform independency. Can anyone give me an idea as i'm a newbie to java
and python but used to C++. My idea is to develop an app which can run both
in windows and linux.

Pls help.

Thanks in advance....

Search Discussions

  • Simon Hibbs at Sep 6, 2006 at 1:06 pm

    Aravind wrote:
    hi,

    some of my friends told that python and java are similar in the idea of
    platform independency. Can anyone give me an idea as i'm a newbie to java
    and python but used to C++. My idea is to develop an app which can run both
    in windows and linux.
    That's true to an extent. Both Java and Python come with extensive
    standard libraries, providing a useful toolkit for the programmer.
    Python does have a number of cross-platform GUI toolkits abailable too,
    including one in the standard library, although WxWidgets (formerly
    WxWindows) is also popular.

    I'd say that Python is easier to learn and more productive as a
    language, but Java has a much larger selection of add-ons and libraries
    available. I can't give you much more help without knowing what the app
    will do, and therefore what language features or library/framework
    support would be helpful.

    Simon Hibbs
  • Andy Dingley at Sep 6, 2006 at 1:45 pm

    Aravind wrote:

    some of my friends told that python and java are similar in the idea of
    platform independency.
    Similar in goal, but quite different in approach.

    Python supports lots of platforms and goes to great lengths to offer
    facades around whatever features a platform does have, so as to offer
    the same benefits as Unix. Java lives in a virtualised environment
    where it pretends there aren't any platforms. Perl pretends everything
    _is_ Unix and falls flat when it isn't.

    If you can cope with this, Java is simpler and less platform-bound.

    If you actually need to get OS-level work done, Python is wonderful.
    You can write stuff that hooks in at a fairly deep level, yet really is
    portable.
  • Jorgen Grahn at Sep 6, 2006 at 2:24 pm

    On Wed, 6 Sep 2006 17:53:29 +0530, Aravind wrote:
    hi,

    some of my friends told that python and java are similar in the idea of
    platform independency. Can anyone give me an idea as i'm a newbie to java
    and python but used to C++.
    Well, what Java and Python (and some other languages) have in common is a
    large standard library.

    The C++ standard library is smaller, and doesn't cover things like advanced
    file I/O, networking, concurrency, or user interfaces. You either have to
    find third-party portable libraries for the things you want to do, or target
    a specific platform.

    As a side note, Python differs from Java by happily including non-portable
    things in its standard library. If Unix people need access to poll(2); fine,
    then they make it available, even though it won't work on e.g. Win32.
    And document that it isn't portable.

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
    \X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn!
  • Bruno Desthuilliers at Sep 6, 2006 at 2:48 pm

    Aravind wrote:
    hi,

    some of my friends told that python and java are similar in the idea of
    platform independency.
    Well, not quite IMHO.

    Java treats the problem by taking the autistic attitude of pretending
    the underlying platform doesn't exists - which can be a major PITA.

    Python is much more pragmatic, and can even offer really strong
    integration with the platform *without* sacrifying portability - the
    core language is platform-independant and tries to help you wrinting
    platform-independant code (cf the os and os.path modules), and
    platform-specific stuff is usually isolated in distinct packages with a
    BIG caution note on it !-)
    Can anyone give me an idea as i'm a newbie to java
    and python but used to C++. My idea is to develop an app which can run both
    in windows and linux.
    With a GUI ? If so, you probably want to check out wxPython or PyGTK
    (wxPython will also buy you MacOS X IIRC, and wil perhaps be easier to
    install on Windows).

    Else (web, command-line, what else ?), you should not have any
    particular problem as long as you avoid using platform-specific packages
    and always use the portability helper features (ie os.path etc).

    Coming from C++, you'll probably need a few days to grasp Python's
    object model and idioms (Python looks much less like a dumbed-down C++
    than Java), but my bet is that you'll be productive *way* sooner with
    Python, and *much* more productive.

    My 2 cents,
    --
    bruno desthuilliers
    python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
    p in 'onurb at xiludom.gro'.split('@')])"
  • Jason at Sep 6, 2006 at 9:36 pm

    Bruno Desthuilliers wrote:
    With a GUI ? If so, you probably want to check out wxPython or PyGTK
    (wxPython will also buy you MacOS X IIRC, and wil perhaps be easier to
    install on Windows).
    Just a warning: wxPython does operate slightly differently between Mac
    OS X, Linux, and Windows. The differences are usually minor and easy
    to clean up in a cross-platform manner, but be aware that you need to
    test on all platforms that you're going to release on.

    For example, MDI apps are anthema to Linux's GTK, so wxGTK uses a
    tabbed dialog to approximate the same thing. While Mac OS X can
    associate a Python object (in my case, None) with a hidden top-level
    tree control node, Windows will throw a C++ assertion.

    If you are used to using MFC, wxWidgets (which wxPython uses) provides
    a very MFC'ish programming experience. It's pretty decent, and the
    wxPython demo provides lots of neat interactive examples.

    --Jason
  • Bruno Desthuilliers at Sep 7, 2006 at 7:45 am

    Jason wrote:
    Bruno Desthuilliers wrote:
    With a GUI ? If so, you probably want to check out wxPython or PyGTK
    (wxPython will also buy you MacOS X IIRC, and wil perhaps be easier to
    install on Windows).
    Just a warning: wxPython does operate slightly differently between Mac
    OS X, Linux, and Windows. The differences are usually minor and easy
    to clean up in a cross-platform manner, but be aware that you need to
    test on all platforms that you're going to release on.
    I don't think one could pretend writing a cross-platform application
    without testing it on all targeted platforms.

    (snip)
    --
    bruno desthuilliers
    python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
    p in 'onurb at xiludom.gro'.split('@')])"
  • Felipe Almeida Lessa at Sep 7, 2006 at 12:27 pm

    2006/9/7, Bruno Desthuilliers <onurb at xiludom.gro>:
    I don't think one could pretend writing a cross-platform application
    without testing it on all targeted platforms.
    E.g: while creating a free software, you may not have an Apple
    computer but you may want to be *possible* to run your program there.
    You don't test it, but you *think* it runs there. Not everybody has a
    spare MacOS X to test apps.

    Of course, if your software *needs* to run in some particular OS then
    you have to test on it.

    --
    Felipe.
  • Jason at Sep 7, 2006 at 5:10 pm

    Felipe Almeida Lessa wrote:
    2006/9/7, Bruno Desthuilliers <onurb at xiludom.gro>:
    I don't think one could pretend writing a cross-platform application
    without testing it on all targeted platforms.
    E.g: while creating a free software, you may not have an Apple
    computer but you may want to be *possible* to run your program there.
    You don't test it, but you *think* it runs there. Not everybody has a
    spare MacOS X to test apps.
    Ah, but those with the Intel Apples can run Linux, Windows, and Mac OS
    X at the same time! *grin*

    Actually, that's how I'm working on my wx/Python application. I write
    it under Mac OS X and occasionally pull it into my Windows and Ubuntu
    virtual machines for further testing.
    Of course, if your software *needs* to run in some particular OS then
    you have to test on it.
    Certainly. And this point should be emphasized for any cross-platform
    language, especially for folk who may not have done such development
    before. The "write once, run everywhere" phrase does have a footnote.
    Python's documentation is very good at pointing out what is platform
    independent and what isn't, but other packages are not as thorough.

    --Jason
  • Morph at Sep 6, 2006 at 3:28 pm

    On 9/6/06, Aravind wrote:
    hi,

    some of my friends told that python and java are similar in the idea of
    platform independency. Can anyone give me an idea as i'm a newbie to java
    and python but used to C++. My idea is to develop an app which can run
    both
    in windows and linux.


    IMHO i think that in general Python is better than Java for many reason:

    1) Java - statically typed, all variable name must be explicitly declared

    1) Python - you never declare anything. An assignment statement binds a
    name to
    an object, and the object can be of any type.

    2) Java - verbose, too many words than are necessary.

    2) Python - concise, clean-cut brevity.

    3) Java - not compact

    3) Python - Compact

    stupid example:

    Java

    public class HelloWorld
    {
    public static void main (String[] args)
    {
    System.out.println("Hello, world!");
    }
    }

    Python

    print "Hello, world"


    4)Python - You can create mixed list
    4)Java - You can't


    5) Java learning is not fast and easy
    5) Python learning is fast and easy also for newbie developers

    There are other many advantages but it depends from what you want do.




    --
    Morph

    "Non sono i popoli a dover aver paura dei propri governi, ma i governi che
    devono aver paura dei propri popoli."

    (V)
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.python.org/pipermail/python-list/attachments/20060906/a8b40257/attachment.html
  • Andre Meyer at Sep 6, 2006 at 6:17 pm

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 6, '06 at 12:23p
activeSep 7, '06 at 5:10p
posts11
users9
websitepython.org

People

Translate

site design / logo © 2022 Grokbase