> class ExampleModel(Model):
>
>     name = Str()
>
>     @name.getter
>     def name(self):
>         return self._name

I have an additional suggestion to follow up on this syntax. If a
model type's __call__ method were changed to call its getter method,
rather than return the default value, I think it would be possible to
do:

class Test(Model):

    foo = Str()

    @Str()
    def bar(self):
        return self._bar


That seems like a natural extension of the syntax to me, very similar
to using python's property built-in as a decorator. As things
currently stand, I thought we should already be able to do:

class Test(Model):

    foo = Str()

    @Str().getter
    def bar(self):
        return self._bar


but for reasons I don't understand, that raises a SyntaxError.

Darren
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to