[Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

Dustin J. Mitchell python-tutor at v.igoro.us
Wed Jul 5 00:13:25 CEST 2006


dnelson at cae.wisc.edu wrote:
> 1. What's involved in a port of a C program into Python?  (drawmap is  
> offered in a number of linux distributions btw.)

It really (really) depends on the C program -- C's so flexible that you
can write in a "Pythonish" style (specifically, avoiding pointer tricks,
keeping OS-specific stuff to a minimum, and using good functional / data
abstractions) or in a style that's so obfuscated as to make any sort of
translation impossible.  The flip side of that is that Python is
flexible enough to accommodate many programming styles.  It sounds like
this program basically parses an input file and produces an output file,
 so I would bet that you can find some existing code that will read the
input file, and some other existing code that will write the output
file.  Then you just have to write the middle part.

> 2. Seeing Python hailed as a good language for learning programming,  
> how do you
>     rate it as a lifetime language? (I can imagine that many people have
>     settled into one language for doing the remainder of their life's work. If
>     I am pressed, I will choose Perl at this point.)

Eep, Perl!  Once a polyglot, always a polyglot.  My choice of language
depends on the context.  For quick web stuff, PHP (O! How I hate thee!).
 For quick manipulation of files and/or using lots of external programs,
shell.  For just about everything else, Python.


More information about the Tutor mailing list