On 20.04.2010 17:43, ext Mark Summerfield wrote:

Seems good to me. However, there needs to be a decision about whether to
provide the QVariant(type, object) factory function or static
QVariant.type() methods. I prefer the factory function.

Oops, should've read more carefully. *blushes*

Also, I should have written them my Pythonically (rather than like
C++!):

     # static functions approach
     QVariant.ushort(pythonObject) ->  QVariant
     QVariant.uint(pythonObject) ->  QVariant

     # factory function approach (based on Richard Dale's ideas)
     QVariant("ushort", pythonObject) ->  QVariant
     QVariant("uint", pythonObject) ->  QVariant

Applied this.

I have to say I still prefer the former approach. It gives a fighting chance to syntactic checkers (as in IDEs) to detect typos and other errors. Also, since the underlying Qt QVariant only accepts a limited number of types and probably won't change too much (if at all), the increased versatility would be kinda wasted (if I have understood correctly).

Furthermore, static functions is the method PyQt already uses, and if there are no significant advantages in either syntax, I think we ought to pick the more comformant one. I'd even go as far to change the function names as follows:

    QVariant.fromUInt(pythonObject) -> QVariant

It's a bit uglier but that's the syntax PyQt already uses and the names would be identical to QVariant.Type constants.

But then again, I'm hardly experienced enough on PyQt/PySide programming to have strong opinions about this one.

Cheers,

ma.
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to