Python paradigms

Nick Maclaren nmm1 at
Mon Apr 10 04:31:52 EDT 2000

In article <3H4I4.709$4w1.17557 at>,
Darrell <darrell at> wrote:
>> x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0)
>if a != NULL:
>    x=a[i].weeble
>if b != NULL:
>    x=x+b[i].wombat
>Isn't this more clear?
>In fact isn't not much if any longer than the "C" version when you count the
>parens used.

No.  Firstly, it relies on an artifact of my example (i.e. that it is
in an assignment, rather than a test condition or function call) and,
secondly, the more lines that code takes the harder it is to see the
function in its entirety.

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