[Python-Dev] What if we didn't have repr? (original) (raw)
Ethan Furman ethan at stoneleaf.us
Mon May 20 20:23:10 CEST 2013
- Previous message: [Python-Dev] What if we didn't have repr?
- Next message: [Python-Dev] What if we didn't have repr?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 05/20/2013 11:14 AM, Mark Janssen wrote:
I have pondered it many times, although usually in the form "Why do we need both str and repr?" Here's an idea: considering python objects are "stateful". Make a general, state-query operator: "?". Then the distinction is clear. --> ?"This is a string" #Returns the contents of the string This is a string Then repr() is clearly the object "as it is" -- unstripped; i.e., not just it's state (or contents, or whatever).
You can have that now, just make your repr do what you want.
--
Ethan
- Previous message: [Python-Dev] What if we didn't have repr?
- Next message: [Python-Dev] What if we didn't have repr?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]