Conditional operator in Python?

Steve Holden sholden at holdenweb.com
Fri Apr 6 08:10:59 EDT 2001


"Tim Peters" <tim.one at home.com> wrote ...
[ ... ]
> > How does that compare to Knuth's view?
>
> Uncle Don and I have never disagreed on this point!  Don't go looking to
stir
> up trouble, Andrew.  If you must, join me in complaining about his C
coding
> style.  Like:
>
>   t=TT-1; while (t) {
>     for (j=KK-1;j>0;j--) ul[j+j]=ul[j],u[j+j]=u[j];     /* "square" */
>     for (j=KK+KK-2;j>KK-LL;j-=2)
>         ul[KK+KK-1-j]=0.0,u[KK+KK-1-j]=u[j]-ul[j];
>     for (j=KK+KK-2;j>=KK;j--) if(ul[j]) {
>       ul[j-(KK-LL)]=ulp-ul[j-(KK-LL)],
>         u[j-(KK-LL)]=mod_sum(u[j-(KK-LL)],u[j]);
>       ul[j-KK]=ulp-ul[j-KK],u[j-KK]=mod_sum(u[j-KK],u[j]);
>     }
>     if (is_odd(s)) {                             /* "multiply by z" */
>       for (j=KK;j>0;j--)  ul[j]=ul[j-1],u[j]=u[j-1];
>       ul[0]=ul[KK],u[0]=u[KK];       /* shift the buffer cyclically */
>       if (ul[KK]) ul[LL]=ulp-ul[LL],u[LL]=mod_sum(u[LL],u[KK]);
>     }
>     if (s) s>>=1; else t--;
>   }
>   for (j=0;j<LL;j++) ran_u[j+KK-LL]=u[j];
>   for (;j<KK;j++) ran_u[j-LL]=u[j];
>
> taken from an especially impenetrable section of
>
>     http://www-cs-staff.stanford.edu/~uno/programs/rng-double.c
>
Really, Tim, I should have thought this was intuitively obvious to the
meanest intelligence.

so-perhaps-i-am-a-dummy-after-all-ly y'rs  - steve






More information about the Python-list mailing list