Set literals

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Tue Mar 22 00:03:59 CET 2005


George Sakkis wrote:

> How about overloading curly braces for set literals, as in
> 
>>>> aSet = {1,2,3}
> 
> - It is the standard mathematic set notation.
> - There is no ambiguity or backwards compatibility problem.
> - Sets and dicts are in many respects similar data structures, so why
> not share the same delimiter ? 

This was the proposed syntax (with {-} being the empty set - there's the
ambiguity). The issue may be revisited for Python 3K, but for now there
will not be syntax support for sets.

Read the section on 'Set Notation' in:
http://www.python.org/peps/pep-0218.html

Tim Delaney



More information about the Python-list mailing list