Blackbird wrote: > Blackbird <[EMAIL PROTECTED]> 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..
Aarghh... the command line interpreter of course use both repr and eval. In fact, when presented by a top level (unindented) expression, <expr> and print repr(eval('<expr>')) the two lines produce the same output, so this last program *is* in fact the interpreter. Now I'll get some sleep, and a life, and stop talking to myself on usenet. -- http://mail.python.org/mailman/listinfo/python-list