kalekundert / byoc

MIT License
0 stars 0 forks source link

Different decorator syntax #40

Open kalekundert opened 2 years ago

kalekundert commented 2 years ago

Could I do something like this?

class MyApp:
    x = byoc.param()

    @x.get
    def _(self, value):
        pass

    @x.set
    def _(self, value):
        pass

Right now I have:

class MyApp:

    @byoc.param()
    def x(self, value):
        pass

But this only works for get, and I don't like to use is because it messes up the consistency with all the other params. This new syntax would be less obtrusive and could support more functions (e.g. cast() maybe).

One think to think about is that currently, the name of the method is significant. With this proposed syntax, it might not be.