This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Albert.Ferras, Ramchandra Apte, benjamin.peterson, ebfe, jcea, r.david.murray, terry.reedy
Date 2012-11-02.22:22:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1351894968.48.0.193742627481.issue16385@psf.upfronthosting.co.za>
In-reply-to
Content
(Benjamin, did you mean 'silently accepting duplicates'?)

Without more use cases and support (from discussion on python-ideas), I think this should be rejected. Being able to re-write keys is fundamental to Python dicts and why they can be used for Python's mutable namespaces. A write-once or write-key-once dict would be something else.

As for literals, a code generator could depend on being able to write duplicate keys without having to go back and erase previous output. A lint-type code checker program could check for duplicate keys. OP: have you checked to see if PyLint or PyChecker or ... already do this? I think this is the appropriate place for such a thing. Lukas' code could be modified to do this also.

Keeping keys alphabetical (possibly within sections) should also solve this specialized problem.
History
Date User Action Args
2012-11-02 22:22:49terry.reedysetrecipients: + terry.reedy, jcea, benjamin.peterson, r.david.murray, ebfe, Ramchandra Apte, Albert.Ferras
2012-11-02 22:22:48terry.reedysetmessageid: <1351894968.48.0.193742627481.issue16385@psf.upfronthosting.co.za>
2012-11-02 22:22:48terry.reedylinkissue16385 messages
2012-11-02 22:22:46terry.reedycreate