2008/12/17 Li Han <lihang9...@gmail.com>:
> On 12月18日, 上午7时12分, Scott David Daniels <scott.dani...@acm.org> wrote:
> Scott wrote:
>> Try:  print repr(repr("'"))
>> that might enlighten you.
>
> I found that print( repr( repr( arbitarystring ) ) ) == repr
> ( arbitarystring )

As I stated previously, the key rule is:

eval(repr(something)) == something

That is, repr() gives a string of Python code that, when evaluated,
results in what you gave to repr().

So repr('') ==> "''"
And repr("''") ==> "\"''\""
Which when print()-ed is: "''"
And eval("''") is the same as entering two apostrophes ('') at the
REPL, both of which give an empty string object.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to