[PyKDE] Printing empty QStrings

Boudewijn Rempt bsarempt at rempt.xs4all.nl
Sat Nov 4 11:08:52 GMT 2000


On Fri, 3 Nov 2000, Phil Thompson wrote:

> Andrew Kuchling wrote:
> > 
> > On Thu, Nov 02, 2000 at 05:50:15PM +0000, Phil Thompson wrote:
> > >I'm more and more inclined to go with repr of a null QString and an
> >                                        ^^^^
> > >empty QString to both return an empty Python string. Generally QString
> > 
> > This is a typo for str, right?  repr() is commonly used for debugging
> > printouts, so you usually want as much info as possible.
> 
> No it's not a typo. At the moment str isn't implemented and falls back
> to repr. One of the suggestions I made was to implement str and have
> both null and empty QStrings return an empty Python string, and to have
> repr return (for a null QString) soemthing like "<null QString at
> zzzz>".
> 
> Would this be the best compromise, consistent with the rest of Python?
> 

Yes: I would prefer repr to give a hint about what kind of object it is,
while str to return an empty Python string for both QString() and
QString(""), would be useful. 





More information about the PyQt mailing list