[Python-3000] Set literal

Thomas Wouters thomas at python.org
Fri Jan 25 19:39:44 CET 2008

On Jan 25, 2008 10:01 AM, Leif Walsh <adlaiff6 at gmail.com> wrote:

> On Jan 25, 2008 12:37 PM, Christian Heimes <lists at cheimes.de> wrote:
> > The pipe char is ambiguous because is no direction. It was suggested and
> > rejected last year.
> Out of almost-pure devil's advocacy, has <> been considered?  My first
> instinct is that it would be ambiguous with less-than/greater-than,
> but if someone can convince me otherwise, might it work?  After all,
> it's the only other balanced pair of punctuation I see on my keyboard.

Yes. And yes, even if the idea wasn't rejected, the parser wouldn't be able
to handle it. The same goes for |, too. The syntax would be ambiguous, and
Python's parser would not be able to ever 'close' a set, because the closing
character would be eaten by the expression inside the set.

 set([1, 2, 1|2]) -> |1, 2, 1|2|
 set([1>0, 2, 3]) -> <1>0, 2, 3>

For some situations, a more clever parser would be able to figure it out,
but there would still be purely ambiguous cases. And Guido has repeatedly
stated he wants Python to remain parseable by a simple parser, even if we
were to make CPython's parser more powerful. Weirder balanced-pairs have
also been suggested, and rejected (both because they don't improve the
readability and parsing situation, and because they just look absurd :)

Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20080125/02e62bcb/attachment.htm 

More information about the Python-3000 mailing list