Complementary language?

Alex Martelli aleaxit at yahoo.com
Sun Dec 26 03:59:57 EST 2004


HackingYodel <taoiststarter at -nospam-yahoo.com> wrote:

> Hello all!  I'm learning to program at home.  I can't imagine a better
> language than Python for this.  The ideal situation, for me, would be to
> study two languages at the same time.  Probably sounds crazy, but it 
> works out better for me.  Being a newbie, I find almost all languages
> fascinating.  C, D, Objective-C, Ocaml, C++, Lisp, how is a non-tech to
> choose?  Does any single language do a better job in Python's weaker 
> areas? Would anyone care to suggest one to supplement Python.  That is,
> if you could only use Python and one other language, which would it be?

I assume you mean _programming_ language in the strict sense, because,
otherwise, I think SQL (which is more of a _query_ language) or XML
(which is a _markup_ lanugage) might be more "urgent" learning needs
than any second _programming_ language.  So, within programming...:

Probably C, but Pyrex is also a strong contender for _use_.  Problem is,
there are a zillion great books on C, none on Pyrex: thus, having to
choose one of them, C enjoys a huge advantage in _learning_.  Also,
while Pyrex is amazingly mature and solid, it no doubt still has some
little way to go -- for example, the pypy project had to introduce a
small extension to Pyrex (the ability to inject inline C code, namely
labels and goto statements) in order to use Pyrex as the target for code
generation -- while C's completeness and stability are indisputable.

C's key advantages: it has much the same _philosophy_ as Python --
simplicity, lack of redundancy, trust in the programmer -- while aiming
squarely at the LOW end of language levels, closer to the machine, as
much as Python aims squarely at the HIGH end, closer to application
programming needs.  This makes them a great complement for each other.

Pyrex is close to "C with Python syntax" and is designed for ease of
interfacing with Python, generating on your behalf all the boilerplate
code that you'd normally need to do the interfacing with the Python C
API directly.  Still, I've never taught Pyrex to anybody who didn't
already know at least _some_ C, so it feels risky to recommend as "the
one othe language besides Python"...

I haven't looked at D enough to judge whether it's fully portable, fully
stable, and just as easy to interface with Python as C; also, I don't
know how the material available for it compares to C's excellence.

Objective-C is cool... on the Mac; I'm not sure how well-supported it is
elsewhere, though.  In addition to C's advantages, it would let you make
Cocoa GUIs on the Mac easily (with PyObjC &c).  But then, the right way
to study Obj-C from scratch is no doubt to start with C, anyway.

OCAML and other modern functional languages are great, but not
particularly easy to use in cooperation with Python.  If you had to pick
one for purely cultural purposes, though, I'd suggest Haskell... simpler
and sharper... OCAML is relatively Big and Rich, which may be a
practical plus but for study purposes is rather a minus, I think.  Much
the same applies to (Common) Lisp and C++: huge languages, very rich,
which may be a plus for practical production uses but surely isn't for
study purposes.


Alex



More information about the Python-list mailing list