Why aren't colons optional?

Courageous jkraska at san.rr.com
Sun Jan 20 16:54:51 EST 2002


>   Is ['a':1, 'b':2, 'c':3] not feasible?

How do you represent an empty dictionary? While indeed a parser with
a 3 token looheahead could distinguish a non empty initializer for
either a list or a dictionary as being uniquely one or the other,
the empty case is entirely ambiguous. I suppose it could have been

x = []
y = [:]

I can't see, however, how that's any more clear than what we have
now.

C//




More information about the Python-list mailing list