replace(*[, parameters][, return_annotation])
Create a new Signature instance based on the instance replace was invoked on. It is possible to pass different parameters
and/or return_annotation
to override the corresponding properties of the base signature. To remove return_annotation from the copied Signature, pass in Signature.empty
.
>>> def test(a, b): ... pass >>> sig = signature(test) >>> new_sig = sig.replace(return_annotation="new return anno") >>> str(new_sig) "(a, b) -> 'new return anno'"
Please login to continue.