[PyKDE] ANNOUNCE: PyQt/PyKDE v0.10pre5

Richard Jones Richard.Jones at fulcrum.com.au
Tue Dec 7 23:15:08 GMT 1999


[Boudewijn Rempt]
> Of course, since Python strings are 8-bit clean you can just as easily
> store Unicode data in them (in fact, you can store any binary data in
> them - although I don't know whether you can embed null characters in
> Python strings)

    Just so you know, yes you can:

>>> 'Say hello to Mr Null: \0...'
'Say hello to Mr Null: \000...'


> Perhaps it would be neat to have QString.latin1(), QString.utf8(),
> QString.local8bit() and QString.unicode() return a Python string - with
> the bytes in the chosen encoding, as an equivalent of the array of QChars.
> Could be combined with a repr which returns the QString in the current
> encoding.

   I like this idea a lot. Mind you, I still have a problem with using repr 
here - I still think it's an abuse of the function when str() should be used. I 
would like to see a toPyString or asPyString method which returns the QString 
in the "current encoding".


       Richard






More information about the PyQt mailing list