inverse of __repr__ ?

Fredrik Lundh fredrik at pythonware.com
Thu Jan 13 07:28:16 EST 2000


Thien-Thi Nguyen wrote:
> i've looked through _programming python_ for the inverse of __repr__, but
> could not find anything.  perhaps i'm missing some clue?

> or is there no way to extend the reader in a python repl?

if "reader" means the python source parser, as exposed
by eval/exec/compile, it's limited to python syntax.  or in
other words:

    x == eval(repr(x))

only holds for simple types.

dunno what a "repl" is, so I cannot answer the rest
of your question.

</F>





More information about the Python-list mailing list