On Thu, Apr 15, 2004, Guido van Rossum wrote: >Greg Ewing: >> >> But who cares about the gory details of the internals? The most >> important thing about a repr() is to unambiguously indicate the >> object's type; the next is to show something about its value, as far >> as reasonably possible. What's actually inside the object doesn't >> matter much. > > I didn't see the start of this, but the guidelines for repr() are and > have always been this: if at all possible it should be an expression > that, when fed to eval(), (assuming the right imports are in scope), > returns an object with the same type and value. In most cases, this > means it should resemble a call to the constructor with suitable > arguments. If that isn't possible, a form surrounded with <...> > should be used, and it should at least show the object's type and some > stuff that can be used to distinguish different instances (either the > address or some representative property of the instance). Right. Question is, to what extent does "human readable" factor in after these criteria? -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "I used to have a .sig but I found it impossible to please everyone..." --SFJ
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4