[issue45054] json module should issue warning about duplicate keys

2021-11-13 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> bob.ippolito ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45054] json module should issue warning about duplicate keys

2021-11-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: -0 on doing this. The suggested warning/error adds overhead that everyone would pay for but would almost never be of benefit. I haven't seen this particular problem arise in practice. The likely reasons it doesn't come up are 1) that generated data

[issue45054] json module should issue warning about duplicate keys

2021-11-11 Thread Andrei Kulakov
Andrei Kulakov added the comment: Another good option would be to use typed dict like `mydict : dict[int,str] = {}`; and use typed values when populating the dict; this way a type checker will warn you of inconsistent key types. -- ___ Python

[issue45054] json module should issue warning about duplicate keys

2021-11-11 Thread Andrei Kulakov
Andrei Kulakov added the comment: In general this sounds reasonable; - but a couple of thoughts / comments: - If you have a dict with mixed numbers in str format and in number format (i.e. ints as numbers and ints as strings in your case), you are creating problems in many potential places.

[issue45054] json module should issue warning about duplicate keys

2021-08-31 Thread Kevin Mills
Kevin Mills added the comment: Sorry to the people I'm pinging, but I just noticed the initial dictionary in my example code is wrong. I figured I should fix it before anybody tested it and got confused about it not matching up with my description of the results. It should've been: import

[issue45054] json module should issue warning about duplicate keys

2021-08-30 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45054] json module should issue warning about duplicate keys

2021-08-30 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +bob.ippolito ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45054] json module should issue warning about duplicate keys

2021-08-30 Thread Kevin Mills
New submission from Kevin Mills : The json module will allow the following without complaint: import json d1 = {1: "fromstring", "1": "fromnumber"} string = json.dumps(d1) print(string) d2 = json.loads(string) print(d2) And it prints: {"1": "fromstring", "1": "fromnumber"} {'1':