A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/103736.html below:

bug? __repr__ vs. __str__

bug? __repr__ vs. __str__ bug? __repr__ vs. __str__Bruce Edge bedge at troikanetworks.com
Fri Apr 20 18:43:10 EDT 2001
Does this seem broken to anyone else?

>>> class T:
...   def __repr__(self):
...     return "repr"
...   def __str__(self):
...     return "str"
... 

>>> t =T()
>>> str(t)
'str'

>>> l=[t,t,t,t]
>>> str(l)
'[repr, repr, repr, repr]'

I would have expected:
'[str, str, str, str]'

-Bruce.

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4