[Python-3000] No Container Literals

Fredrik Johansson fredrik.johansson at gmail.com
Sun Jul 9 00:11:14 CEST 2006


I'm -0 on the proposal; it might make the syntax more streamlined, but
I don't see a practical benefit. The current distinction between
different types of brackets works very well. I absolutely don't see
how it'd be worth to throw away dict literals just to buy set literals
(the natural spelling would be set(1,2,3) with this change, anyway).

On 7/8/06, Georg Brandl <g.brandl at gmx.net> wrote:
> How would you spell {1: 2} with your syntax?

I'd just create dicts from lists of tuples. Unfortunately
dict((1,'a'), (2,'b'), (3,'c')) is an extremely clumsy syntax, but an
alternative might be to change the role of ; to become a sequence
separator with lower precedence than a comma. Then you could write
dict(1,'a'; 2,'b'; 3,'c'). (And use the more Matlab-like syntax [1,2,3
; 4,5,6 ; 7,8,9] to create a matrix.) I'm not advocating this change
to this language, just providing a possible answer to the question.

Fredrik


More information about the Python-3000 mailing list