Force optional parameters to be required for some setting

Viewed 89

I have created some class,

class c:
    def __init__(self, mode=False):
        if mode:
            force foo to require optional_parameter

    def foo(self, optional_parameter=""):
        print("something %s" % optional_parameter)

Is there a way that if the class is instantiated with mode=True that all optional_parameter values are required when calling the method, effectively no longer optional?

2 Answers
Related