inverse of __repr__ ?
Michael Hudson
mwh21 at cam.ac.uk
Thu Jan 13 15:09:02 EST 2000
"Fredrik Lundh" <fredrik at pythonware.com> writes:
> 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?
No.
> 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.
Read-Eval-Print-Loop. Lisp terminology, I think, and one of the things
that makes both Python and Lisp as fantastic as they are.
Cheers,
Michael
More information about the Python-list
mailing list