Using self.* as default value for a method [duplicate]

Use a default of None and detect that.

def save_file(self, outputfilename=None): 
    if outputfilename is None:
        outputfilename = self.image_filename
    self.file.read(outputfilename)
    ....

Leave a Comment