On Wed, 04 Aug 2004 09:46:55 -0400, Jim Fulton <jim at zope.com> wrote: > Terry Reedy wrote: > > .... > > > Decorators will add complexity, regardless of syntax. > > Especially in their current over-powered form. If decorators didn't have to > take arguments, then you could use a syntax like: > > def classmethod foo(cls, ...): > ... > > This does add complexity, but I think it enhances understandability. > > I understand why some people want to be able to pass arguments to decorators, > but frankly, I find many of the examples of doing so down right scary. I wonder if we should have add a note to the Python style guide that forbids such things from the standard library <0.2 wink>. > > An advantage of the > > @ syntax is than it makes the complexiity separable and ignorable for > > someone learning/teaching basic Python, > > I don't agree that they are ignorable. People will see them in code > and will *have* to understand what they mean. Given sme examples > I've seen here, this will sometimes be a significant chalenge. It certainly depends on the use. I don't think @classmethod will be any more or less confusing than the current practice of calling foo = staticmethod(foo) after the def. I agree that more elaborate uses may be confusing; then again, I suspect that more elaborate code will be confusing regardless of how it uses decorators. Jeremy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4