Welcome Robert. My response below.
Follow-ups to Python-Ideas, thanks. You'll need to subscribe to see any
further discussion.
On Fri, Jun 16, 2017 at 11:32:19AM +0000, Robert Vanden Eynde wrote:
> In a nutshell, I would like to be able to write:
> y = (b+2 for b = a + 1)
I think this is somewhat similar to a suggestion of Nick Coghlan's. One
possible syntax as a statement might be:
y = b + 2 given:
b = a + 1
https://www.python.org/dev/peps/pep-3150/
In mathematics, I might write:
y = b + 2 where b = a + 1
although of course I wouldn't do so for anything so simple. Here's a
better example, the quadratic formula:
-b ± √Δ
x = ─────────
2a
where Δ = b² - 4ac
although even there I'd usually write Δ in place.
> Python already have the "functional if", lambdas, list comprehension,
> but not simple assignment functional style.
I think you mean "if *expression*" rather than "functional if". The term
"functional" in programming usually refers to a particular paradigm:
https://en.wikipedia.org/wiki/Functional_programming
--
Steve
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/