Re: Hack or beauty?
"Michael F. Stemper" <[email protected]> Thu, 14 May 2026 13:25:01 -0500
| Newsgroups | comp.lang.python |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
On 13/05/2026 14.33, Stefan Ram wrote: > "Michael F. Stemper" <[email protected]> wrote or quoted: >> for variable in angles if options.angle else comps: > , is fine, but I think what would be a bit clearer might be, > > variables = angles if options.angle else comps > for variable in variables: I ended up going with something quite similar: ##################################################### if options.angle: junk = sys.stdout.write( "0.00 " ) variables = [pi/20*k for k in range(1,8)] else: junk = sys.stdout.write( " 0% " ) variables = [0.1*k for k in range(1,8)] # ... # Loop over a range of angle or compensation values for variable in variables: # Do stuff #################################################### Much clearer and less "cute". (Yes, the range of angles changed from my prototype.) -- Michael F. Stemper What happens if you play John Cage's "4'33" at a slower tempo?