Python object.__repr__(self) should be an expression?
<p>I was looking at the builtin object methods in the <a href="http://docs.python.org/reference/datamodel.html#objects-values-and-types">Python documentation</a>, and I was interested in the documentation for <code>object.__repr__(self)</code>. Here's what it says:</p>

<blockquote>
  <p>Called by the repr() built-in function
  and by string conversions (reverse
  quotes) to compute the “official”
  string representation of an object. If
  at all possible, this should look like
  a valid Python expression that could
  be used to recreate an object with the
  same value (given an appropriate
  environment). If this is not possible,
  a string of the form &lt;...some useful
  description...> should be returned.
  The return value must be a string
  object. If a class defines <strong>repr</strong>()
  but not <strong>str</strong>(), then <strong>repr</strong>() is
  also used when an “informal” string
  representation of instances of that
  class is required.</p>
  
  <p>This is typically used for debugging,
  so it is important that the
  representation is information-rich and
  unambiguous</p>
</blockquote>

<p>The most interesting part to me, was...</p>

<blockquote>
  <p>If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value</p>
</blockquote>

<p>... but I'm not sure exactly what this means. It says it should <em>look</em> like an expression which can be used to recreate the object, but does that mean it should just be an example of the sort of expression you could use, or should it be an actual expression, that can be executed (eval etc..) to recreate the object? Or... should it be just a rehasing of the actual expression which was used, for pure information purposes?</p>

<p>In general I'm a bit confused as to exactly what I should be putting here.</p>
