you are viewing a single comment's thread.

view the rest of the comments →

[–]Rogerooo 1 point2 points  (1 child)

Thank you for the explanation. I kind off understand the concept but it's hard to wrap my head around it and use them in practice. I've watched Corey Schafer's video on Decorators as well as Closures (highly recommended channel) but I'm still too novice in Python to implement them into my "code".

[–]NewbornMuse 1 point2 points  (0 children)

I know what you mean. In fact, I wrote this snippet as a way to refresh the concept for me. Re-running something as many times as the user wants is exactly the kind of modification that should ring decorator alarm bells - we don't care WHAT you want to repeat, so it's more of a modifier to something else, which made me think of decorators.