[PyKDE] QString in PyQt4 - Request for Comments

Torsten Marek shlomme at gmx.net
Tue Oct 18 21:53:07 BST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Phil Thompson schrieb:
> I'm wondering whether QString should be dropped in PyQt4 in order to make it 
> more Pythonic.
> 
> At the moment Python strings and unicode strings are automatically converted 
> to QStrings when passed as arguments - so there would be no change there. If 
> a QString was returned by a method or an operator then a unicode string would 
> be returned instead.
> 
> Obviously you would lose all of QString's methods and would have to rely on 
> what Python gives you for manipulating strings.
> 
> One of the limitations of QString has been that you couldn't do...
> 
> q = "Py" + QString("Qt")
> 
> ...but with current snapshots you can - so this is an argument for keeping 
> QString as it has become easier to use.
> 
> BTW, the following is a consequence of the additional support...
> 
> s = "Py"
> # s is of type str
> s += QString("Qt")
> # s is now of type QString
> 

I second the removal of QString in favour of Python strings. Not having to care
about whether your strings are of type basetring or QString is well worth it, if
there is no considerable loss in functionality.


greetings

Torsten

- --
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDVWCzfMVFHqJEyFgRAr9/AJ46vWDcC/K8RL0aJmWumBG/nP9AAgCcCaGI
s/1tcyZ19ccuL/ZmpjUbBWk=
=6Qdv
-----END PGP SIGNATURE-----




More information about the PyQt mailing list