%r

Blackbird fake at nospam.no
Tue Mar 7 01:25:41 CET 2006


Peter Hansen wrote:
> [...]>
> On the other hand, if 'something' is actually some arbitrary object,
> then it's definitely not always true, especially for anything not
> built in to Python.
>
> -Peter

Yes, I had strings in mind.  And I guess it will work with the other
primitive types, but anything that repr to something like '<function f at
0x0128CFB0>' will crash, since it's not a valid Python expression.

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.

Blackbird





More information about the Python-list mailing list