[Python-3000] sets in P3K?

Jim Jewett jimjjewett at gmail.com
Tue Apr 25 20:29:32 CEST 2006


On 4/25/06, Boris Borcic <bborcic at gmail.com> wrote:
> On 4/24/06, Guido van Rossum <guido at python.org> wrote:
>  > OTOH mathematicians (whether in high school or not) write things like
>  > {x | 2 < x < 10}, which is of course the origin of our list
>  > comprehensions and generator expressions [...]

> Most of the time they use it as "filter" and write something like

> {x ∈ S st. P(x)}

That is the formal form, because then you can specify (for example)
whether x is limited to Real, Rational, or Integers.  But what
actually got used most of the time (in classes I took and texts and
papers I read) was the shorter form Guido mentioned.

On the other hand, one reason the "|" form was preferred is that it
leant itself to defining oddball functions, which in turns suggests a
mapping rather than a set.

-jJ


More information about the Python-3000 mailing list