[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: about __str__
From: Paul Hankin <paul.hankin () gmail ! com>
Date: 2007-09-20 22:26:29
Message-ID: 1190327189.852581.170580 () 57g2000hsv ! googlegroups ! com
[Download RAW message or body]
On Sep 20, 10:08 pm, Konstantinos Pachopoulos <kostaspa...@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
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic