Usage examples¶
Argument default value¶
One important advantage of using these decorators is that they ensure that the
docstrings are correct. This module has as hypothetical version number of
0.14
. Click on the source links to see what the source looks like for each
of these functions.
Look at the doc page to see how your users would see your documetnation.
- default_value.foo(this='that')[source]¶
Prints your parameter.
This function has no deprecation decorator.
- Parameters
- thisstr
This is the string parameter that should be printed
- default_value.foo_deprecated(two=2, this='tim', one=1)[source]¶
Prints your parameter.
This function has a depeprecation decorator set to ‘0.16’
- Parameters
- thisstr
This is the string parameter that should be printed
- Warns
- FutureWarning
In release 0.16 of my super lib, this function will take on new default value(s) for the following keyword argument(s):
this : ‘tim’ -> ‘that’
To avoid this warning in your code, specify the value of all listed keyword arguments.
- default_value.foo_deprecated_13(this='that')[source]¶
Prints your parameter
This function has a deprecation decorator set to ‘0.13’.
- Parameters
- thisstr
This is the string parameter that should be printed.
- default_value.foo_two_params(bar='hello', baz='world')[source]¶
Joins two strings with a space between them.
This function has a no deprecation decorator.
- Parameters
- barstr
The first word to join.
- bazstr
The second word to join.
- default_value.foo_two_params_deprecating(bar='bonjour', baz='monde')[source]¶
Joins two strings with a space between them.
This function has a deprecation decorator set to ‘0.16’.
- Parameters
- barstr
The first word to join.
- bazstr
The second word to join.
- Warns
- FutureWarning
In release 0.16 of my super lib, this function will take on new default value(s) for the following keyword argument(s):
bar : ‘bonjour’ -> ‘hello’
baz : ‘monde’ -> ‘world’
To avoid this warning in your code, specify the value of all listed keyword arguments.
- default_value.foo_two_params_redux(bar='bonjour', baz='monde')[source]¶
Joins two strings with a space between them.
This function has a no deprecation decorator.
- Parameters
- barstr
The first word to join.
- bazstr
The second word to join.
- Warns
- FutureWarning
In release 0.16 of my super lib, this function will take on new default value(s) for the following keyword argument(s):
bar : ‘bonjour’ -> ‘hello’
To avoid this warning in your code, specify the value of all listed keyword arguments.
- FutureWarning
In release 0.17 of my super lib, this function will take on new default value(s) for the following keyword argument(s):
baz : ‘monde’ -> ‘world’
To avoid this warning in your code, specify the value of all listed keyword arguments.
Keyword only deprecation¶
This is how the docstrings will appear if you decide to deprecate positional arguments to keyword.
- kwonly.foo_new(zap='zip', *, bar='hello', baz='world')[source]¶
Adds bar and baz
The decorator will infer the old order of the paramters.
- Parameters
- bar: str
a string
- baz: str
an other python object.
- zap: str
zaps everything to dust
- Returns
- result: str
the sum of the zapping.
- Warns
- FutureWarning
In release 0.15 of my super lib, the argument(s):
bar, baz
will become keyword-only arguments. To avoid this warning, provide all the above arguments as keyword arguments.
- kwonly.foo_new_keep_signature(zap='zip', bar='hello', baz='world')[source]¶
Adds bar and baz
You can choose to keep the old signature.
- Parameters
- bar: str
a string
- baz: str
an other python object.
- zap: str
zaps everything to dust
- Returns
- result: str
the sum of the zapping.
- Warns
- FutureWarning
In release 0.15 of my super lib, the argument(s):
bar, baz
will become keyword-only arguments. To avoid this warning, provide all the above arguments as keyword arguments.
- kwonly.foo_new_swap_arguments(zap='zip', *, baz='world', bar='hello')[source]¶
Adds bar and baz
You can even swap the order of the arguments, though you should specify how they were ordered.
- Parameters
- bar: str
a string
- baz: str
an other python object.
- zap: str
zaps everything to dust
- Returns
- result: str
the sum of the zapping.
- Warns
- FutureWarning
In release 0.15 of my super lib, the argument(s):
bar, baz
will become keyword-only arguments. To avoid this warning, provide all the above arguments as keyword arguments.