[Python-Dev] PEP 3144 review. (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Mon Sep 28 23:29:42 CEST 2009
- Previous message: [Python-Dev] PEP 3144 review.
- Next message: [Python-Dev] PEP 3144 review.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I would say that there certainly are precedents in other areas for keeping the information about the input form around. For example, occasionally it would be handy if parsing a hex integer returned an object that was compatible with other integers but somehow kept a hint that would cause printing it to use hex by default.
At the risk of bringing in false analogies: it seems that Python typically represents values of some type in their canonical form, rather than remembering the form in which they arrived in the program:
- integer values "forget" how many preceding zeroes they have
- string literals forget which of the characters had been escaped, and whether the string was single- or double-quoted
- floating point values forget a lot more about their literal representation (including even the literal decimal value)
I guess a close case would be rational numbers: clearly, 3÷2 == 6÷4; would a Python library still remember (and repr) the original numerator and denominator?
Regards, Martin
- Previous message: [Python-Dev] PEP 3144 review.
- Next message: [Python-Dev] PEP 3144 review.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]