[Python-ideas] Reuse "for" to express "given"

Matt Arcidy marcidy at gmail.com
Thu May 24 23:02:33 EDT 2018


On Thu, May 24, 2018, 14:48 Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

>
>
> On Thu, May 24, 2018 at 4:59 PM Matt Arcidy <marcidy at gmail.com> wrote:
>
>>
>>
>> On Thu, May 24, 2018, 11:47 Alexander Belopolsky <
>> alexander.belopolsky at gmail.com> wrote:
>>
>>> > But I do have a mathematics background, and I don't remember ever
>>> seeing
>>> > "for x = value" used in the sense you mean.
>>>
>>> That's so because in mathematics, "for" is spelled ":" as in
>>>
>>>  {2*a* : *a*∈*Z*}
>>>
>>> If you can read the above, you should not have trouble reading
>>>
>>>  {2*a* + *b* : *a*∈*Z *: *b = *1}
>>>
>>
>> Inverted "A" is "for all", and colon means "such that".  It may be
>> acceptable somewhere to use a colon as you do,
>>
>
> See <https://en.wikipedia.org/wiki/Set_notation>.  Also, "[list
> comprehensions] is Python's way of implementing a well-known notation for
> sets as used by mathematicians." <
> https://www.python-course.eu/list_comprehension.php>.  Although, the
> latter uses "|" instead of ":".
>

My point was more along the lines of math doesn't use ":" for "for".  "for"
exists in math as a different symbol. Even in set builder notation ":"
isn't interpretted as "for", it's "such that."

Maybe the math discussion is totally tangential.  I'm not clear why I'm
making these points really, apologies if I took this off course, I'm happy
to concede the math and just keep my other points.  I don't think "for" is
bad compared to some other alternatives, but I don't see it better than
":=" in the contexts you've raised.  Even in the implementation of set
building, "for" is only used to build the sets element wise, not as a
partitioning, and is not a property if the set itself.


Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180524/d2f2dce1/attachment-0001.html>


More information about the Python-ideas mailing list