Author mark.dickinson
Recipients anders.rundgren.net@gmail.com, eric.smith, ezio.melotti, mark.dickinson, pitrou, rhettinger
Date 2016-01-29.20:32:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454099531.07.0.376997204695.issue26229@psf.upfronthosting.co.za>
In-reply-to
Content
Eric: I suspect he's talking about section 7.1.12.1 of the 6th edition of ECMA-262; a PDF can be found here: http://www.ecma-international.org/ecma-262/6.0/ECMA-262.pdf. Clause 6 applies to this particular example:

"""
If k <= n <= 21, return the String consisting of the code units of the k digits of the decimal representation of s (in order, with no leading zeroes), followed by nk occurrences of the code unit 0x0030 (DIGIT ZERO).
"""

here 'k' is the number of significant digits in the shortest possible representation (i.e., the number of significant digits that Python's repr will use), and n is the "adjusted exponent" of the input (so k = 16 and n = 21 in this case, because 10**20 <= target_value < 10**21).

I'm not convinced of the importance / value of making Python's json implementation exactly correspond to that of Google's JS engine, though. For one thing, there's no spec: ECMA-262 isn't good enough, since (as noted in the spec), the least significant digit isn't necessarily defined by their requirements, so it's still perfectly possible for two JS implementations to both conform with the specification and still give different output strings.
History
Date User Action Args
2016-01-29 20:32:11mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, pitrou, eric.smith, ezio.melotti, anders.rundgren.net@gmail.com
2016-01-29 20:32:11mark.dickinsonsetmessageid: <1454099531.07.0.376997204695.issue26229@psf.upfronthosting.co.za>
2016-01-29 20:32:11mark.dickinsonlinkissue26229 messages
2016-01-29 20:32:10mark.dickinsoncreate