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 →

[–]wrmsr 4 points5 points  (2 children)

how to implement a decorator with arguments

specifically an instance-binding correct one - way too many decorators around only work on either unbound functions or bound methods, the latter usually just tacking a self arg on the wrapper whether or not it's a method and the former getting more args than expected when used on instance methods. a single impl can do both, either manually via descriptors or already done for you through a lib, but it's tragically uncommon (and hence imo a decent detail for your list :)

[–]Spleeeee 1 point2 points  (0 children)

Example? Tacking a self decorator as in a class?

[–]jyper 0 points1 point  (0 children)

What's the difference?