April 2019
Intermediate to advanced
646 pages
16h 48m
English
Having a fixed and well-defined list of arguments for each function makes the code more robust. But this can't be done in the first version, so arguments have to be built by iterative design. They should reflect the precise use cases the element was created for, and evolve accordingly.
Consider the following example of the first versions of some Service class:
class Service: # version 1 def _query(self, query, type): print('done') def execute(self, query): self._query(query, 'EXECUTE')
If you want to extend the signature of the execute() method with new arguments in a way that preserves backward compatibility, you should provide default values for these arguments as follows:
class Service(object): # ...