Python for everything?

Mike Meyer mwm at mired.org
Thu Jun 30 20:55:20 EDT 2005


Ivan Van Laningham <ivanlan at pauahtun.org> writes:
> Mike Meyer wrote:
>> xeys_00 at yahoo.com writes:
>> As other have noted, C was never really used for everything. Unix
>> tools were designed to connect together from the very beginning, which
>> is what makes shell scripting so powerful. This was true before there
>> was a C. Likewise, some things you need more control over the machine
>> than you get in C - those are still done in assembler. These days, C
>> compilers let you embed assembler statements in your C, so some of
>> these things are done in such variants.
> It really was used "for everything"; C compilers have *always* let you
> include assembler, with the "asm" keyword.  Unless you're talking about
> the early days of DOS/Windows compilers, about which I know little, but
> all *K&R* compilers had asm.

Actually, I was thinking of pre-K&R Unix compilers. The v6 Unix
compiler, and the photo7 compiler. I don't believe they had asm
statements. If they did, it wasn't used in the v6 kernel.

> And living with structs instead of classes was not nearly as much of a
> pain in the butt as you make out; it was perfectly reasonable to include
> methods within structs, by including a pointer to a function.  X10 and
> X11 showed just how object-oriented you could get with C, using
> callbacks with required signatures, and specifying how Widgets were to
> be written--contracts before there were contracts.

Yeah, X is a good example of how to do OO programming in a non-OO
language. The current BSD kernels do the same kind of things.  But I'd
say it was a bigger pain in the but than I made out to be. You wind up
having to invoke the function through your data object, and then pass
the data object in - sort of as an explicit "self".

> It's true that OO languages are better, and languages like Python which
> allow you to combine fairly low-level calls with an OO worldview make
> life *vastly* easier, but C is still hugely flexible, highly adaptable,
> and very powerful.  For about 10 or 15 years there, knowing C was pretty
> much a guarantee of a good job.  That changed when C++ compilers became
> common and good and not merely preprocessors that wrote really, really
> ugly C.

I still use C when I need more control/speed than I can get out of
Python (or something modern). And for wrapping things to use in
HLLs.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list