En Sat, 19 May 2007 03:24:15 -0300, walterbyrd <[EMAIL PROTECTED]> escribió:
> My guess is that some of the C code used to develop Python is the same > between the different Python distros, but much of the code is unique > to the particular platform. If that is the case, then the C code may > not be very portable. Well, your guess was wrong. The core CPython code is the same on all platforms; of course it uses #define/#ifdef/etc. where appropiate, but it's not a mess, and not so much code is conditionally compiled. The Python developers take special care on portability - the C language itself (C89 is currently used) is pretty standard, but you have to be careful on how you write your code. > But, I can often take the same python code, and run it on MacOS, > Linux, FreeBSD, and Windows. Often I can do this even if the app has a > gui interface. Because someone has taken out all the differences, so you don't have to struggle with them yourself. GUI toolkits: some libraries "draw" the whole thing and manage all the user interaction themselves so they're basically portable but never have the native "look&feel" (tcl/tk); other rely on the native buttons and controls for each platform, but providing a homogeneous view for the programmer (wxWidgets). Anyway, they work across platforms because "someone" has already worked on the differences for you - using C. Both menctioned libraries are written in C (wx in C++), and Python provides a convenient wrapper for them. Even on the Python side, some libraries do one thing or another depending on the platform (cf: subprocess). The good thing is that *you* as a developer, don't have to worry about the differences; many are managed by Python itself internally, and many are worked on by other people on top of this. webbrowser.open('your favourite url') "just works" and does "the right thing" because of these efforts. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list