[PyQt] PyQt5 NULL QVariant
Phil Thompson
phil at riverbankcomputing.com
Sun May 15 12:40:53 BST 2016
On 15 May 2016, at 12:28 pm, Matthias Kuhn <matthias at opengis.ch> wrote:
>
> On 15/05/16 11:18, Phil Thompson wrote:
>> If you are already able to get away with imposing those restrictions then I'm not going to introduce an incompatibility for everybody else.
> Those restrictions are the best we can get so far, but they did lead to
> confusion once in a while (which I'd be happy to avoid in the future).
>
> Can you confirm that returning empty string and 0 for NULL is expected
> behavior and not seen as a bug?
Yes. If you want to distinguish null QVariants then use sip.enableautoconversion(). The problem is that you are not willing to do that.
> For us it's a minor issue now but I think that "everybody else" did
> write very little code - if any at all - based on this behavior and it
> would be very easy to to fix it in a backwards compatible way ( i.e. `if
> not var` instead of `if var != 0`).
>
> I'm going to be quiet now :-)
Phil
More information about the PyQt
mailing list