Skip to content

Py in 5: Decorators

kaelscion on November 15, 2018

originally published on the Coding Duck blog: Hello everybody and welcome to another Py in 5 discussion. Th... [Read Full]
markdown guide

Great article. Decorators are very useful for writing reusable, boilerplate-free code.
This incredible answer from Stackoverflow taught me about the power and utility of decorators.


That answer is the very summation of the research I did on this post and is extremely comprehensive. With your leave, I would like to add that link to the main article as a deeper dive follow-up source material. Is that alright with you?

I've used decorators for a long time but never started to write my own until a year or so ago. On conception of this article series (Py in 5), I decided to take a deeper look at all of the Pythonic (and programming in general) topics, tips, tricks, and features that I more or less took for granted, and see if I could explain the "under the hood" enough for understanding in 5 minutes or less. This would force me to gain a more complete understanding of the topics myself. That SO post is very similar to the type of material I referenced to gain said thorough knowledge and I thank you so much for sharing it as well as for giving my article a bit of a review! πŸ˜„πŸ˜„πŸ˜„


Feel free to share it. The more people who can read it, the better!


I’d just like to note that in Python, modules aren’t the same as classes. You import a module, but you create an instance of a class.


Great point! This is an important distinction in the understanding the official use of these terms in Pythons context and what they actually mean vs how they can be used. It appears I have fallen prey to using the terms interchangeably. Thank you for pointing that out!

code of conduct - report abuse