Why aren't colons optional?

Neil Hodgson nhodgson at bigpond.net.au
Sun Jan 20 23:01:04 CET 2002


Alex Martelli:

> The use of {} for dictionary-displays is indeed a tiny anomaly (but I
> have no better idea for the general case; for the reasonably common case
> where keys are constant identifiers, of course,

   Is ['a':1, 'b':2, 'c':3] not feasible? It looks easy to disambiguate from
[1, 2, 3] lists although it would introduce a new 'mixing list and
dictionary notation' error for [1, 'a':1]. Doesn't look like it would be
ambiguous with slicing as the contexts are different.

   Neil






More information about the Python-list mailing list