[issue10038] Returntype of json.loads() on strings

2010-10-06 Thread Nik Tautenhahn
New submission from Nik Tautenhahn : Hi, before 2.7, an import json json.loads('"abc"') yielded u"abc". in 2.7 I get "abc" (a byte string). I would have expected an entry in "news" or "What's new in 2.7" why this change happ

[issue10038] Returntype of json.loads() on strings

2010-10-06 Thread Nik Tautenhahn
Nik Tautenhahn added the comment: Well, Ok, if I take bob's comment from the simplejson Issue, I can understand that some people want byte strings. But then I would like to have something like a "parse_str" hook, to enhance my json-Decoder or maybe a keyword argument for t

[issue10038] Returntype of json.loads() on strings

2010-10-07 Thread Nik Tautenhahn
Nik Tautenhahn added the comment: Well, then at least the documentation and the "What's changed" need to be updated. Furthermore, if such decisions are made, it would be at least nice to have some general "decode-hook" for json.JSONDecoder - the "object_hook&q

[issue10038] Returntype of json.loads() on strings

2010-10-07 Thread Nik Tautenhahn
Nik Tautenhahn added the comment: Yep, the solution should not be "maybe it's str, maybe it's unicode" - I mean, if the decoder gives you a str if there are no fancy characters and unicode if it contains some, this might lead to some confusion... And yes, in my opinion,

[issue10038] json.loads() on str should return unicode, not str

2010-11-02 Thread Nik Tautenhahn
Nik Tautenhahn added the comment: There is even more inconsistency here. As already mentioned, we have this: >>> import json >>> json.loads(json.dumps("abc")) 'abc' If, however, I am evil and hide _json.so (which is the C-part of the json module for