[PyQt] Idea: Show QObject.objectName() in __repr__
    Florian Bruhin 
    me at the-compiler.org
       
    Tue Jun 17 10:24:20 BST 2014
    
    
  
I noticed the __repr__ of Qt objects is usually just python's default,
which isn't too useful.
Then I had an idea: What about showing the objectName in __repr__ for
all QObjects as default in PyQt? So basically having something like
this as __repr__:
    def __repr__(self):
        name = self.objectName()
        if name:
            return '<{} named {}>'.format(self.__class__.__name__, name)
        else:
            return '<{}>'.format(self.__class__.__name__)
Florian
-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
             GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140617/66c39e93/attachment.sig>
    
    
More information about the PyQt
mailing list