difference between __repr__() and __str__()
Gregoire Welraeds
greg at perceval.be
Mon Feb 28 12:33:27 EST 2000
The question is in the subject. According to the Python reference manual,
page 17
__repr__: called to compute the official string representation of an
object. This should like a valid Python expression that can be used to
recreate an object with the same value.
__str__: differs from repr in that in does not have to be a valid python
expression: a more conveniant or concise representation maybe used
instead.
What is a valid Python expression ?
I though that repr was called by repr and by string conversion (as
mentionned early in the doc)not to recreate an object ?
What is the use of an official string representation against the
non-official ?
--
Life is not fair
But the root password helps
--
Gregoire Welraeds
greg at perceval.be
Perceval Development team
-------------------------------------------------------------------------------
Perceval Technologies sa/nv Tel: +32-2-6409194
Rue Tenbosch, 9 Fax: +32-2-6403154
B-1000 Brussels general information: info at perceval.net
BELGIUM technical information: helpdesk at perceval.net
URL: http://www.perceval.be/
-------------------------------------------------------------------------------
More information about the Python-list
mailing list