[Python-3000] Set literals - another try

Guido van Rossum guido at python.org
Wed Aug 9 20:36:32 CEST 2006


On 8/8/06, Talin <talin at acm.org> wrote:
> Part 1: The concrete proposal part.
>
> I noticed that a lot of folks seemed to like the idea of making the
> empty set resemble the greek letter Phi, using a combination of
> parentheses and the vertical bar or forward slash character.
>
> So lets expand on this: slice Phi in half and say that (| and |) are
> delimiters for a set literal, as follows:
>
>     (|)     # Empty set
>
>     (|a|)   # Set with 1 item
>
>     (|a,b|) # Set with 2 items
>
> The advantage of this proposal is that it maintains visual consistency
> between the 0, 1, and N element cases.

-1.

This attempts to solve the lack of an empty set literal in the current
best proposal, which is set(), {1}, {1, 2}, {1, 2, 3} etc. But it does
so at the tremendous cost of inventing new unfamiliar brackets.

> Part 2: The idle speculation part, not to be considered as a actual
> proposal.
[...]
> The syntax that comes to mind is something like this:
>
>     a = b|c

This would be ambiguous since b|c also means set union.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list