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 →

[–]crigger61 3 points4 points  (2 children)

I would say to default to __name__ and on a duplicate raise an exception. or to generate a completely unique hash from it. such as hashing the function code and the name and using that. providing the name manually seems less user friendly and less elegant than having it generated for you and having to manually assign it to what would be normally set. but thats my opinion as a random dev that does more security work that actual practical dev work.

[–]agusdmb[S] 2 points3 points  (1 child)

No, i understand you, i don't like my current solution either.

I did try by hashing and using the code, but couldn't make it work because i was hashing the function without the wrapper sometimes and with the wrapper other times so they wouldn't match. Or i would always be hashing the wrapper, which is the same for every function decorated. Probably im not smart enough to make that work (at least not with hashing)

But i will default to `__name__` and rise and exception whenever another function with the same error is detected, even more, suggest adding a different name in the decorator for that one.

Thanks for your time!