Re: %r
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: %r

From: Blackbird <fake@nospam.no>
Date: Tue Mar 07 2006 - 02:09:17 CET

Blackbird <fake@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..
Received on Sun Apr 30 11:02:04 2006