I read a thing and am now confused and would appreciate anyone clearing up the confusion if they know:
what's the point of "decorators" in the python programming language?
@Felthry (And yes, the backslash in the tag rather than a forward slash did make me wince. XD)
@zetasyanthis Sorry, video stuff takes a lot of spoons for us and I don't think we can right now, but thanks for the link
@Felthry Fair enough. Just shared in case it'd help. :)
@Felthry They're syntactic sugar, these are equivalent:
@decorator
def func():
whatever
def func():
whatever
func = decorator(func)
@Trinket But what is the purpose of saying func = decorator(func)?
@Felthry Hm, are you asking for a better explanation, or are you saying you understand what they do and you just don't get why this is a common enough thing to need its own syntax?
@Trinket What I meant was that I didn't get why it was a common enough thing to need its own syntax, but someone else explained that so I get it a bit mroe now!
@Felthry Oh hahah, yeah in practice I don't think I've ever actually written my own, the only ones I use regularly are @property and Pyramid's @view_config
@Felthry I've not used them a bunch myself yet, but I was /just/ watching this this morning. Seems to be a wrapper for an existing function to allow you to parameterize an inner function. https://www.youtube.com/watch?v=RD4Gptp1tO0