Issue 3198: strings don't seem to roundtrip with repr() (original) (raw)
Issue3198
Created on 2008-06-25 13:33 by mark, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (2) | ||
---|---|---|
msg68728 - (view) | Author: Mark Summerfield (mark) * | Date: 2008-06-25 13:33 |
With 2.5.2 and 30b1 strings don't round trip like numbers do. I guess it has been like this a long time so isn't a bug, but it does seem inconsistent. Both 2.5.2 and 30b1: >>> x = 5 >>> x == int(repr(x)) True >>> x = "Test Text" >>> x == str(repr(x)) False The reason is that an extra set of enclosing quotes are added. | ||
msg68729 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * ![]() |
Date: 2008-06-25 13:51 |
repr() is supposed to round-trip with eval() for common types. str() is the function that round-trips with the original type: >>> x = 5 >>> x == int(str(x)) True >>> x = "Test Text" >>> x == str(str(x)) # :-) True |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:35 | admin | set | github: 47448 |
2008-06-25 13:51:06 | amaury.forgeotdarc | set | status: open -> closedresolution: not a bugmessages: + nosy: + amaury.forgeotdarc |
2008-06-25 13:33:50 | mark | create |