compute function default value for each call
Project description
Return a function whose default values will be computed for each call,
instead of evaluating the default values when function definition is executed.
make sure this function is the last(closest to the function) decorator
Usage:
@default_value_for_each_call.compute_default_value_for_each_call
def foo(a=([])):
a.append(3)
print a
foo()
foo()
Output:
[3]
[3]
instead of evaluating the default values when function definition is executed.
make sure this function is the last(closest to the function) decorator
Usage:
@default_value_for_each_call.compute_default_value_for_each_call
def foo(a=([])):
a.append(3)
print a
foo()
foo()
Output:
[3]
[3]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for default_value_for_each_call-0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52da690dd95a39161f740c8d300b432a4e574d6af5d2d0f6647b78821fa3d9d2 |
|
MD5 | da9c3ffb414aa7317f5e338cfb656f48 |
|
BLAKE2b-256 | 38f41b8697c448cc4036030ece46868a3afcd4739926c948547a054b74bf2bce |