about __str__
Paul Hankin
paul.hankin at gmail.com
Thu Sep 20 18:26:29 EDT 2007
On Sep 20, 10:08 pm, Konstantinos Pachopoulos <kostaspa... at yahoo.gr>
wrote:
>
> The __str__ method of "list" doesn't seem to call the __str__ method of
> the objects....
> ie, __str__ is not equicalent to the Java toString() method... Anyway,
> how can i fix this?
For whatever reason, __str__ of list calls repr rather than str on
its elements.
You can fix your code by adding __repr__ in your class:
Class CmterIDCmts:
def __init__ ...
def __str__ ...
__repr__ = __str__
--
Paul Hankin
More information about the Python-list
mailing list