Before 78a62b3 it was possible to pass a default value in a form of a callable object with __str__ defined. An object's string representation made its way to the help text - a behavior which was actually a feature. Now it's always just (dynamic) which is fine for simple functions, but not very useful and limiting in case of callable objects. To showcase that this can be actually a useful feature, an example:
class EnvDefault:
"""A default which shows the actual value of an environment variable
in the help text. This is different from envvar=.
"""
def __init__(self, envvar, default):
self.envvar = envvar
self.default = default
def __call__(self):
return os.environ.get(self.envvar, self.default)
def __str__(self):
return str(self())
Before 78a62b3 it was possible to pass a default value in a form of a callable object with
__str__defined. An object's string representation made its way to the help text - a behavior which was actually a feature. Now it's always just(dynamic)which is fine for simple functions, but not very useful and limiting in case of callable objects. To showcase that this can be actually a useful feature, an example: