Python paradigms

Nick Maclaren nmm1 at
Sat Apr 8 04:38:56 EDT 2000

Well, starting to use Python, there are two Algol 68 constructions
that I sorely miss.  Here is an example of them in C:

    if ((x = non_trivial_expression) != NULL) {
    } elif ((x = another_expression) != NULL) {
    } ...


    x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0)

It is pretty obvious why Python doesn't have the former, but I am
a bit puzzled as to the reason for the lack of the latter.  Or
maybe I just haven't found it yet :-)

However, my main point is that the above constructions clarify some
types of code a great deal.  Creating ad-hoc functions is all very
well, but too many of them (especially trivial ones, used once)
obscure the program considerably.  And please note that the above
constructions are NOT an artifact of my coding style - in what I
am doing, they arise naturally out of the problem.

What paradigms are there for replacing such constructions by?

Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1 at
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

More information about the Python-list mailing list