Python paradigms
Nick Maclaren
nmm1 at cus.cam.ac.uk
Mon Apr 10 04:31:52 EDT 2000
In article <3H4I4.709$4w1.17557 at typhoon.nyroc.rr.com>,
Darrell <darrell at dorb.com> wrote:
>> x = (a != NULL ? a[i]->weeble : 0) + (b != NULL ? b[i]->wombat : 0)
>
>x=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.
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email: nmm1 at cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
More information about the Python-list
mailing list