Terry J. Reedy added the comment: (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. ---------- nosy: +terry.reedy _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16385> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com