Python compared to other language

Michael Torrie torriem at chem.byu.edu
Sat May 19 13:51:20 EDT 2007


On Fri, 2007-05-18 at 22:28 -0400, Steve Holden wrote:
> Surely the fact that Python is available on so many platforms implies 
> that C is a fairly portable language. I realise that you have to take 
> platform specifics into account much more than you do in Python, but I 
> do feel you are being somewhat unfair to C.

This is now going off-topic.  Cross-platform code is a matter of mindset
and toolset.  It's very possible to write python code that is *not*
cross-platform compatible.  Perhaps it relies a specific behavioral
quirk of the platform.  Or maybe it uses modules that only exist on a
platform.  For example, you can do very low-level COM or even Active X
programming using python.  That certainly wouldn't run on Linux.  The
same can be true of some python code that's only intended to run on
Posix systems.  You may have assumed a certain directory character
separator, for example (of course the os module can give you a portable
way of not making this assumption).

I write cross-platform C code all the time.  I do it by carefully
choosing my libraries (toolset) and then try to code making as few
assumptions as possible.  Platform-specific code is generally less than
6% of the total code.  I even wrote a cross-platform python module in C.
It's no big deal.  Recently I wrote a medium-sized C++ application using
Qt.  The platform-specific code (basically a few minor things Qt doesn't
do for me) is 10 lines total, out of many thousands of lines of code.
The apps compiles and runs on Linux, OS X, and Windows.  I plan to write
the next version in Python, but I'm still not sure what GUI toolkit to
use.  wxWidgets just doesn't sit well with me, Qt's licensing doesn't
fit my client (I can't afford the non-GPL version), and GTK isn't there
on OS X.

Python, like C, can be used easily to make cross-platform programs.
Python makes it even easier than C because the entire standard python
library of modules is available on every platform, so you don't have to
rely on as many third-party abstraction libraries for threads, sockets,
etc.  I think the original poster will find Python, and may wxPython,
satisfies the bulk of his development needs.

> 
> > I'm just learning Python. FWIW: my opinions about Python:
> [ ... ]
> 
> regards
>   Steve
> -- 
> Steve Holden        +1 571 484 6266   +1 800 494 3119
> Holden Web LLC/Ltd           http://www.holdenweb.com
> Skype: holdenweb      http://del.icio.us/steve.holden
> ------------------ Asciimercial ---------------------
> Get on the web: Blog, lens and tag your way to fame!!
> holdenweb.blogspot.com        squidoo.com/pythonology
> tagged items:         del.icio.us/steve.holden/python
> All these services currently offer free registration!
> -------------- Thank You for Reading ----------------
> 




More information about the Python-list mailing list