Hi,
Darren Dale suggested a few days ago using a decorator syntax for
declaring Qt properties. Since that sounded like such an awesome idea,
I'd like to discuss it a bit further.
Having not that much experience with Qt properties, do you think the
decorator syntax could be just:
class C(object):
@QtCore.Property
def x(self):
return self._x
@x.setter
def x(self, value):
self._x = value
@x.deleter
def x(self):
del self._x
That is, the only difference to Python property decorators [1] would be
that instead of @property you'd have @QtCore.Property.
Would that work in practice? How about the implementation: is there
going to be a clash with PSEP 103 [2]?
Just mimicking Python's native property decorators would leave many of
the arguments in PSEP 103 out of reach. The freset argument would be
easy - just define an @x.resetter decorator. How about all of the other
arguments, taking non-function values? What would be a a clean,
consistent syntax for defining them?
This, together with Hugo's PSEP 102 draft [3], would make great
improvements for the next post-1.0 API. (Hugo, let's revive that draft -
I can work with you on honing it further, if you'd like.)
[1] http://docs.python.org/whatsnew/2.6.html
[2] http://www.pyside.org/docs/pseps/psep-0103.html
[3] http://www.pyside.org/docs/pseps/psep-0102.html
Cheers,
ma.
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside