[PyQt] Repr for "value" objects

Giovanni Bajo rasky at develer.com
Mon Dec 17 13:50:49 GMT 2007


On 12/17/2007 2:40 PM, Giovanni Bajo wrote:
> Hi,
> 
> there are many classes in PyQt which would benefit from a custom 
> __repr__ method to show their contents. For instance, I'm getting tired 
> of having to write:
> 
>    def mousePressEvent(self, e):
>        print e.pos().x(), e.pos().y()
> 
> instead of:
> 
>    def mousePressEvent(self, e):
>        print e.pos()
> 
> just because I otherwise get "<PyQt4.QtCore.QPoint object at 0x298EA468>".
> 
> Are there any plans to add this to PyQt? I'm happy to provide a list of 
> objects that might have a custom repr method, and even to actually write 
> the code (if Phil explains me how he prefers this to be submitted -- 
> given metasip).

See also a previous post of mines with the same request:
http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg07175.html

with another example of why this would be useful.
-- 
Giovanni Bajo



More information about the PyQt mailing list