May-02-2023, 07:58 PM
While I see your point, I don't see how my suggestion breaks anything, although comparing
class A: def foo(self): return 10 foo = getter(foo) def foo(self, value): # this erases the foo that we just defined print('Hello there!') foo = setter(foo) def foo(self): # again this erases the foo that we just defined print('Deleting foo') foo = deleter(foo)to
class A: @getter def foo(self): return 10 @setter def foo(self, value): # this erases the foo that we just defined print('Hello there!') @deleter def foo(self): # again this erases the foo that we just defined print('Deleting foo')I don't see a whole lot of difference. I still think my suggestion is clearer. Again, I don't see how my suggestion breaks any existing code since there are not currently @getter, @setter, or @deleter decorators. In the absence of any changes, I would prefer to use your latest format since that is the most consistent.