-
- Downloads
add tests for default parameter values in value functions
The semantics for default parameters are as follows. If a value function has a parameter that takes a default value, then an exception is raised if the user ever tries to assign a value to this parameter via 'params'. These semantics are chosen to eliminate the possibility that "forgotten" default parameters are not silently overwritten.
-
This is the first time I run into the issue of default values in value functions and didn't find any other discussion of this. So why is the default behaviour that parameters that have default values in value functions are ignored when there is an entry in
params
with the same name? To me it seems quite counterintuitive. This behaviour makes the use of defaults pointless as there is no way to change them, one might as well hard code the values for these parameters.Edit: Now I found the discussion of MR215 that addresses this. But I tested this with
kwant 1.3.2
andparams
with default values seem to be ignored already there. It would be nice if some warning or error was raised when a value function contains keyword only parameters, because this behaviour is rather counter-intuitive and prone to errors.Edit 2: This only happens when using wraparound. See kwant/kwant#228 (closed)
Edited by Dániel Varjas