Re: Hack or beauty?

2026-05-14 Thread Ethan Furman
On 5/14/26 01:32, Left Right via Python-list wrote: > [...] "else" is > allowed in "strange" places in Python, eg. > > for var in iterator: > else: > statement > > with the intention of executing the "statement" when the loop exits > early. Not sure what you mean by "exits ear

Re: Hack or beauty?

2026-05-14 Thread Michael F. Stemper via Python-list
On 13/05/2026 15.52, Mark Bourne wrote: Michael F. Stemper wrote: if options.angle:    angles = [0.05*k for k in range(7)] else:    comps = [0.1*k for k in range(6)] for variable in angles if options.angle else comps: The `angles

Re: Hack or beauty?

2026-05-14 Thread Left Right via Python-list
I see why this would be questionable: 1. operator precedence. 2. grammar rules. If we are talking about operator precedence, it's hard to tell without consulting the manual (and even then?) what happens first. "else" is allowed in "strange" places in Python, eg. for var in iterator: else

Re: Hack or beauty?

2026-05-14 Thread Michael F. Stemper via Python-list
On 13/05/2026 14.33, Stefan Ram wrote: "Michael F. Stemper" 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

Re: Coming In Python 3.15: Sentinel Values

2026-05-14 Thread Mats Wichmann
On 5/12/26 08:52, Tim Daneliuk via Python-list wrote: I stipulate that there is some utility to a sentinel feature.  But it does so at a cost.  That cost is bloating the language definition with yet another feature that has fairly limited application beyond what is already possible. I've seen