[Python-ideas] Inline assignments using "given" clauses

Brendan Barnwell brenbarn at brenbarn.net
Sun May 13 14:27:38 EDT 2018

On 2018-05-13 04:23, Steven D'Aprano wrote:
> In my experience mathematicians put the given *before* the statement:
>     Given a, b, c three sides of a triangle, then
>         Area = sqrt(s*(s-a)*(s-b)*(s-c))
>     where s = (a + b + c)/2 is the semi-perimeter of the triangle.
> For the record, that is almost exactly what I wrote for a student
> earlier today, and its not just me, it is very similar to the wording
> used on both Wolfram Mathworld and Wikipedia's pages on Heron's Formula.
> http://mathworld.wolfram.com/HeronsFormula.html
> https://en.wikipedia.org/wiki/Heron%27s_formula
> Putting "given" after the expression is backwards.

	Yes, but that's because we're ruling out the use of "where".  At this 
point I would be fine with "snicklefritz" as the keyword.  The point is 
that I want to put SOMETHING after the expression, and this is not at 
all unusual.  See for instance Wikipedia pages on the Reimann zeta 
gravitation equation 
(https://en.wikipedia.org/wiki/Gravity#Newton%27s_theory_of_gravitation), and 
compound interest 
  If we have to use the word "given" even though the word mathematicians 
would use in that position is "where", that's not such a big deal.

Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is no 
path, and leave a trail."
    --author unknown

More information about the Python-ideas mailing list