[Python-ideas] Possible method of distinguishing between set-literals, dict-literals, and odict-literals

Gerald Britton gerald.britton at gmail.com
Tue Jun 16 16:11:30 CEST 2009

We surely need a real-world example of a problem this solves.  Without
something dramatically compelling, I can't imagine that your proposed
syntax will have a ghost of a chance of being taken seriously.

On Tue, Jun 16, 2009 at 9:55 AM, Ben Finney<ben+python at benfinney.id.au> wrote:
> Carl Johnson
> <cmjohnson.mailinglist at gmail.com> writes:
>> we could introduce an empty set-literal and an odict-literal, and add
>> a more explicit form to replace the existing set literal.
> What do you mean by “more explicit”? The existing set literal syntax
> is quite explicit.
>> s{} could be the empty set, o{} could be an empty odict, and we could
>> leave {} alone as the form for dicts. So, an odict literal would look
>> like o{'a':'1', 'b':'2', 'c':'3'} instead of OrderedDict([('a', '1'),
>> ('b', '2'), ('c', '3')]). And the set {'a', 'c', 'b'} could
>> (optionally?) have a little s{'a', 'c', 'b'} to make it more explicit
>> that this is a set, not a dict.
> I don't think that word “explicit” means what you think it means.
>> So what do people think? Is this too ugly to do?
> You haven't really identified a problem that is solved by this. And yes,
> I think it's significantly uglier than the existing syntax.
>> Does it confuse users who are used to C-style braces? Or is it a
>> logical extension of the b"", r"", etc. system that could help make
>> things follow EIBI better?
> (Presuming you mean “EIBTI”, for “Explicit Is Better Than Implicit”.)
> I don't see anything implicit about the following forms:
>    set()
>    OrderedDict()
>    frozenset()
> So I think you're trying to achieve something else other than
> “explicit”, but I don't know what it is, nor what the problem is that
> needs addressing.
> --
>  \           “Never express yourself more clearly than you are able to |
>  `\                                               think.” —Niels Bohr |
> _o__)                                                                  |
> Ben Finney
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas

Gerald Britton

More information about the Python-ideas mailing list