Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197791

Re: Hack or beauty?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From "Michael F. Stemper" <michael.stemper@gmail.com>
Newsgroups comp.lang.python
Subject Re: Hack or beauty?
Date Thu, 14 May 2026 13:25:01 -0500
Organization A noiseless patient Spider
Lines 35
Message-ID <10u541t$ksmb$1@dont-email.me> (permalink)
References <10u2hla$2tnlr$1@dont-email.me> <if-20260513203200@ram.dialup.fu-berlin.de>
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 14 May 2026 18:25:01 +0000 (UTC)
Injection-Info dont-email.me; logging-data="684747"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19miFFcXpkDGhiLuWgw8FaT7NVOXeN/MD4="; posting-host="1c2a070510767b88c8e93d871c76fb74"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
Cancel-Lock sha1:WnLZ0HctFaxdY6Y00K+3cTLbpdA= sha256:iypfDkbidnSZtXUfM/0xFTkv3DGmwhMa10Gpr8y927s= sha1:geU7HoVM9dcBkt9FV6p2QJzMFBE=
In-Reply-To <if-20260513203200@ram.dialup.fu-berlin.de>
Content-Language en-US
Xref csiph.com comp.lang.python:197791

Show key headers only | View raw


On 13/05/2026 14.33, Stefan Ram wrote:
> "Michael F. Stemper" <michael.stemper@gmail.com> 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?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Hack or beauty? "Michael F. Stemper" <michael.stemper@gmail.com> - 2026-05-13 13:58 -0500
  Re: Hack or beauty? ram@zedat.fu-berlin.de (Stefan Ram) - 2026-05-13 19:33 +0000
    Re: Hack or beauty? ram@zedat.fu-berlin.de (Stefan Ram) - 2026-05-13 21:04 +0000
      Re: Hack or beauty? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-05-14 01:06 +0000
    Re: Hack or beauty? "Michael F. Stemper" <michael.stemper@gmail.com> - 2026-05-14 13:25 -0500
  Re: Hack or beauty? Mark Bourne <nntp.mbourne@spamgourmet.com> - 2026-05-13 21:52 +0100
    Re: Hack or beauty? "Michael F. Stemper" <michael.stemper@gmail.com> - 2026-05-14 08:06 -0500
  Re: Hack or beauty? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-05-13 21:37 +0000

csiph-web