[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] "None" conversion to QString?
From: "Giovanni Bajo" <rasky () develer ! com>
Date: 2005-04-10 17:02:30
Message-ID: 004b01c53def$14afa2a0$074f2597 () bagio
[Download RAW message or body]
Phil Thompson <phil@riverbankcomputing.co.uk> wrote:
>> is there a point on allowing None to be converted to QString, that
>> is to match QString in argument list of functions?
>>
>>>>> from qt import *
>>>>> a = QApplication([])
>>>>> QPushButton("foo", None)
>>
>> <qt.QPushButton object at 0x00813600>
>>
>>>>> QPushButton(None, None)
>>
>> <qt.QPushButton object at 0x008135D0>
>>
>> This makes it impossible for instance to disambiguate between the
>> constructors of QListViewItem, for instance:
>>
>> QListViewItem(QListViewItem* parent, QString label1, QString label2
>> = "", QString label3 = "")
>> QListViewItem(QListViewItem* parent, QListViewItem* after, QString
>> label1, QString label2 = "", QString label3 = "")
>>
>> If you call this as:
>>
>> QListView(None, None, "foo")
>>
>> PyQt will effectively call the first constructor rather than the
>> second. I believe I could use sip.cast to disambiguate but I would
>> like to know the rationale behind the choice of allowing None as
>> null string.
>
> Hmm - a good question. Apart from QByteArray, QCString and QString,
> PyQt consistently maps NULL to None and vice versa. I suspect its
> from the early days of PyQt when the signature checking wasn't as
> sophisticated and, in particular, didn't check when it knew a pointer
> was going to be dereferenced.
>
> The current behaviour is wrong and I'll change it. There is a danger
> that the change might break some code.
Yes, but as with the typed enum change, it's for a good cause. Thanks.
Giovanni Bajo
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic