Code basics

Jeff Pinyan jeffp at crusoe.net
Fri Mar 17 18:06:51 CET 2000


[posted & mailed]

>while( notDone )
>{
>    int chip = this.getNumberOfSomething();
>    if (chip == 10 )
>    {
>        System.out.println("Tjohoo");
>    }
>    else
>    {
>        System.out.println("Oh no!");
>    }
>}

I'll be a jerk, and do this brevity-style:

  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. :)

-- 
MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve             japhy at pobox.com
http://www.pobox.com/~japhy/                  http://pinyaj.stu.rpi.edu/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/




More information about the Python-list mailing list