[PyKDE] QString and + operator
rasky at develer.com
Thu Apr 14 12:15:09 BST 2005
Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
>> I'm making a requirement for a project I'm working on to work with
>> instead of the built-in type as much as possible. Some will obviously
>> complain about this, needing to cast to str() to keep some pythonic
>> for concatenation, augmented assignment, etc. I remember seeing in this
>> that Phil mentioned supporting the '+' operator for mixed types. I
>> the problem is determining what to return. Is there still an interest in
>> exposing this?
> I thought I had implemented it - must have slipped through the cracks. It
> will be in the next snapshot.
> Note that...
> q = QString("foo") + QString("bar")
This one is OK with me (it's a faitful binding of the existing C++ operator)
> q = QString("foo") + "bar"
> ...will both work, but...
> s = "foo" + QString("bar")
> ...will not.
Is there a need for QString+str in the first place? If not, I'd rather not
have it: explicit is better than implicit :)
Also, having it working one way but not the other is confusing. So better
prohibit mixed types altogether IMO.
More information about the PyQt