[Python-3000] Detecting conflicts in dict displays

Steven Bethard steven.bethard at gmail.com
Tue Jul 11 07:11:40 CEST 2006


On 7/10/06, Guido van Rossum <guido at python.org> wrote:
> Currently, this is valid:
>
>   a = {'a': 1, 'a': 2}
>   print a     # {'a': 2}
>
> I wonder if we shouldn't make this a run-time error instead.

If it's possible, definitely.  That's gotta be a typo if it appears in
real code.

> If people agree, what should we do with
>
>   a = {'a': 1, 'a': 1}
>
> ???

It should also be an error.  I can't imagine that not being a typo.
And there isn't really any reason to write that since we're talking
dict literals here.

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list