[Python-3000] sets in P3K?

Boris Borcic bborcic at gmail.com
Tue Apr 25 15:30:29 CEST 2006


On 4/24/06, Guido van Rossum <guido at python.org> wrote:
 > [...] Python has 'in' for <epsilon>',
Isn't it an inconsistency that Python admits 'in' as a concise english 
equivalent to ∈ (and 'not in' for ∉) while λ requires painful spelling out as
'lambda' ?
NB : this mail means to bring to mind the possibility of supporting math glyphs 
in source code. With unicode, non-ascii glyphs tend to get supported to 
surprising levels by usual tools. So I use a few in this utf-8 mail, if they 
don't make it unscathed through the moderator's mail to the list's website and 
back to browsers, no need to worry further I'd say. But they may well make it.
 > [...] {1,2,3} is certainly
 > unambiguously the best notation for set literals
Nit : when I was initiated to sets in primary school ("new math" generation), we
had to write it exactly as {1;2;3}.
 > [...] I believe
 > that mathematicians use a crossed-out little oh to indicate the empty
 > set,
∅ you mean ?
 > so a notational discontinuity is not unheard of.
 >
 > 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)}
which is the cause that I regularly do the mistake in Python, to write
(x in S if p(x))
when I should write
(x for x in S if p(x))
but I guess the advent of the ternary if-else operator buried the last slimmer
of hope to see that syntax evolve in the context of 1-token-lookahead parsing :(
Regards, Boris Borcic
--
assert "304" in "340343", "P424D15E M15M47CH"


More information about the Python-3000 mailing list

AltStyle によって変換されたページ (->オリジナル) /