You can change the default value as follows:
Wait.timeout = 20
Will mean that if unset, the default will be 20.
eg:
>>> class Wait:
... timeout = 9
... def __init__(self, timeout=None):
... if timeout is not None:
... self.timeout = timeout
...
>>> a = Wait()
>>> b = Wait(9)
>>> a.timeout
9
>>> b.timeout
9
>>> Wait.timeout = 20
>>> a.timeout
20
>>> b.timeout
9
This exploits the fact that Python searches for class attributes if it does not find an instance attribute.
source
share