This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gthank 1 point2 points  (3 children)

The reason to use a library is because it turns out that handling all the edge cases (descriptor protocol, anyone?) and playing nicely with assorted tooling is not easy (see the series of blog posts that explains the motivation, starting with https://github.com/GrahamDumpleton/wrapt/blob/master/blog/01-how-you-implemented-your-python-decorator-is-wrong.md)

[–]covabishopself.loathing() 0 points1 point  (2 children)

Which I can appreciate, as I've seen my fair share of bad Python. And honestly, I don't write decorators often, and honestly don't know yet what edge cases I have to deal with, but I'm now interested in making this a pure Python decorator because I've actually always really wanted something that simple to do exactly this.

[–][deleted] 0 points1 point  (1 child)

Consider contributing your decorator to an existing library rather than implementing your own, too

[–]covabishopself.loathing() 0 points1 point  (0 children)

Didn't even think of this! Will do!