On 24 March 2018 at 04:09, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Mar 24, 2018 at 2:00 AM, Steven D'Aprano <st...@pearwood.info> > wrote: > > I see you haven't mentioned anything about Nick Coglan's (long ago) > > concept of a "where" block. If memory serves, it would be something > > like: > > > > value = x**2 + 2*x where: > > x = some expression > > > > These are not necessarily competing, but they are relevant. > > Definitely relevant, thanks. This is exactly what I'm looking for - > related proposals that got lost in the lengthy threads on the subject. > I'll mention it as another proposal, but if anyone has an actual post > for me to reference, that would be appreciated (just to make sure I'm > correctly representing it). >
That one's a PEP reference: https://www.python.org/dev/peps/pep-3150/ If PEP 572 were to happen, then I'd see some variant of PEP 3150 as a potential future follow-on (allowing the statement local namespace for a simple statement to be populated in a trailing suite, without needing to make the case for statement locals in the first place). If inline local variable assignment were to happen instead, then PEP 3150 would continue to face the double hurdle of pitching both the semantic benefits of statement locals, while also pitching a syntax for defining them. FWIW, I like this version of the statement local proposal, and think it would avoid a lot of the quirks that otherwise arise when allowing expression level assignments. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/