%r

Blackbird fake at nospam.no
Mon Mar 6 20:09:17 EST 2006


Blackbird <fake at nospam.no> skrev:

>>
> Is the interpreter in fact using repr(), or parts of it, to generate
> output when you type an expression at the command prompt?  The
> results sure look similar.

Let me clarify this:  The interpreter uses eval.  No doubt about that. But

>>> eval('f')
<function f at 0x0128CFB0>
>>> repr(f)
'<function f at 0x0128CFB0>'

So there is still a connection between eval and repr that I don't fully
understand, besides the fact that eval (among other things) is the inverse
of repr.  Do they share some code, and if so, what part?  Well, I guess I
could of course take a few weeks off and dive into the source... not sure my
wife would approve..





More information about the Python-list mailing list