backquote

Sean Ross sross at connectmail.carleton.ca
Thu Mar 11 10:52:35 EST 2004


"Olaf Meding" <OlafMeding at compuserve.com> wrote in message
news:9e5ea2c4.0403110753.5c4d437a at posting.google.com...
> Is `object` (using backquotes) the same as saying str(object)?  Trying
> to understand how backquotes work.  Thanks for your help.
>
> Olaf

>>> class C:
...  def __repr__(self):
...   return "repr"
...  def __str__(self):
...   return "str"
...
>>> c = C()
>>> str(c)
'str'
>>> repr(c)
'repr'
>>> `c`
'repr'
>>>






More information about the Python-list mailing list