How to build a decorator with optional parameters? [duplicate]

Published: 14/01/2020
How to build a decorator with optional parameters? [duplicate]
Source: STACKOVERFLOW.COM

This question already has an answer here: How to create a Python decorator that can be used either with or without parameters? 11 answers Making decorators with optional arguments [duplicate] 14 answers I would like to make a decorator which could be used with or without a parameter : Something like this : class d(object): def __init__(self,msg='my default message'): self.msg = msg def __call__(

Read more
Related news
Comment
FACEBOOK