[Python-3000] set literals

Guido van Rossum guido at python.org
Sat Jul 8 05:03:18 CEST 2006


-1.

On 7/7/06, tomer filiba <tomerfiliba at gmail.com> wrote:
> i had this idea -- since quoted literals can be prefixed by a letter
> that alters their meaning, why not use the same semantics
> with curly braces?
>
> "hello" -- byte string literal
> r"hello" -- unescaped byte string literal
> u"hello" -- unicode string literal
>
> {1:2, 3:4, 5:6} -- dict literal
> s{1, 2, 3} -- set literal
>
> {} -- empty dict literal
> s{} - empty set literal
>
> this is more explicit, as {1:2} as {1,2} are too similar imo, and also
> solves the no-literal-for-empty-set issue that has been discussed
> at length.
>
> this should only be a slight change to the parser, and is a syntax
> error today, so there shouldn't be any backward-compat issues.
>
> it may look strange at first (at least it me), but it's just a matter of
> getting used to -- it's not any stranger than u"hello"
>
>
> -tomer
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>


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


More information about the Python-3000 mailing list