Code basics
Lance Ellinghaus
Lance.Ellinghaus at avnet.com
Fri Mar 17 14:36:59 EST 2000
For some of us (C programmers by trade), this type of coding is very normal and
has no readability problems.
In C you could do the following:
printf( (getNumberOfSomething()==10 ? "Tjohoo" : "Oh no!") );
When I first saw this code posted, I thought "Nice! Clean and simple"...
Lance Ellinghaus
-------From: Justin Sheehy on 03/17/2000 1:28:22 PM-------
From: Justin Sheehy <dworkin at ccs.neu.edu>
To: python-list
cc:
Subject: Re: Code basics
Jeff Pinyan <jeffp at crusoe.net> writes:
> while notDone:
> print ("Oh no!","Tjohoo")[this.getNumberOfSomething() == 10]
>
> Now, I ask you folk, is that "bad" Python? Is that "bad" programming in
> general, to be brief and succinct like that? I'm curious -- I have a
> tendency to do things like that.
I'd call it bad programming, because succintness should not take
priority over readability. Unless you're using some other P___ language.
Besides, you used one more line than you needed. <wink>
-Justin
--
http://www.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list