Working on this Kata makes decorators more accessible.
This comment is hidden because it contains spoiler information about the solution
Great kata! Now I have much better understanding of decorators :)
really nice kata. helps a lot if you want to see if you understand decorators in python.
that's what i like about codewars. it has some exercises that could be useful in a real application and not just acedemic purpose.
I think the description should be clearer, I'm not sure if I enter n and use the first function, whether the first n numbers should be returned, or all but the last items with value of n should be returned.
Apparently, you should reload this kata, so there isn't so much information - I've changed it.
I'm not really sure what the both() function adds to this kata, personally I probably wouldn't include it. That's my opinion anyway
I belive this has now been resolved
That was a good one!
I believe that is all sorted now, I made them both class methods because I think that fits better. Also put in the extra check you mentioned
warning: do you check, after the deletion of a function, that decorating a new one with the same name actually removed the previously decorated ones?
The way you built those delete functionnalities is rather weird. I'd expected something like FuncAdd.delete(func). Here, you're asking for func.delete() which is quite a different matter (maybe...).
=> not sure what to to, actually.
EDIT: thing is: if clear is a staticmethod, delete should be too, imo. But that's an opinion.
Note: in the deletion tests, you have functions in PascalCase => should be snake_cased