> Function decorators
There are decorators that return a callable that not calls the function that was given as an argument, but also do some other things, and therefore change the behaviour of that function.
> So instead of
>
> a = Char(length=10, value='empty')
>
> you want
>
> @Char(length=10)
> a = 'empty'
>
> ?
There is a standardized way. You can extend ``property`` or mimic its implementation. Then instead of
class Foo:
a = property(getter, no_cycles)
You can write
class Foo:
a = NoCycles()
I haven't linked to a how-to for doing this is, because I think it's unnecessary for most small projects. Every so often someone asks for a more pleasant syntax for specifying a property, getter and setter. Guido seems to consistently reply that he thinks our current situation is good enough. I'd dig up a link to the email archive for you, but Google wasn't being very kind to me.