Python compared to other language

"Martin v. Löwis" martin at v.loewis.de
Sun May 20 13:48:45 EDT 2007


>> But that is my point. With Python, the language itself takes care of
>> the platform differences, so the same Python code will run on
>> different platforms. I realize that, at a lower level, everything is
>> done is C. But, from the developers point of view: developing code in
>> C requires more attention to platform specifics, than does developing
>> code in Python.
>>
> That I can agree with, but it  isn't the same as "not portable". It
> would have been better to say "more difficult to port".

Indeed, there are significant chunks (several hundred lines of code)
that are specific to Microsoft Windows; also, there are some modules
(e.g. nis, passwd) which solely run on Unix systems. This code is
inherently unportable. In some cases, there is alternative code for
other platforms, in some cases, there isn't.

In Python itself, the fraction of platform-specific code is still
small (I think - one would have to count to be sure). This is partly
due to Python only using file and network IO from the system, and
these two system-dependent aspects have fairly standard APIs
even on the C level (POSIX in particular).

GUI is much harder - in Tk, the amount of system-specific code is
significant (ca. 80 kLOC specific to either Unix, Windows, or Mac,
compared to 240 kLOC total, for Tk 8.4.7). Fortunately, Python
abstains from implementing its own cross-platform GUI library,
and offloads that burden to third-party libraries.

Regards,
Martin



More information about the Python-list mailing list