confusing behaviour when invalid value functions are specified
Consider the following example:
def invalid_vf(site, *, d):
return 1
lat = lattice.square(norbs=1)
syst = Builder()
syst[lat(0)] = invalid_vf
syst = syst.finalized()
syst.hamiltonian_submatrix()
This will raise the following error:
TypeError: invalid_vf() missing 1 required keyword-only argument: 'd'
when IMO it should raise
ValueError: Keyword-only arguments are not allowed in value functions
The reason it does not is because we only raise errors detected from invalid value functions when params
is specified. IIRC we did this for backwards compatibility reasons, but I'm not sure.
This seems like a bug to me.
See also !347 (merged).