I have the following setting. I have 3 functions, draw1, draw2 and draw3. All of them get as input an image, and some other parameters (different parameters for various draws, but the image is always one of the parameters).
For every draw function (let's say draw1), I want to define another function with the following properties: The parameters are the same as draw1 parameters + boolean parameter called "in_place". If in_place=True -> draw on the image with draw1 and return the image. If in_place=False -> make a copy of the image and draw on the copy of the image with draw1 and return the copy of the image.
This "expansion" of draw1 is identical to all the draw functions. How can I do this in clean way? Decorators can be used here?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire