change lambda to callable in docs

This commit is contained in:
robertmartin8
2021-10-19 21:00:20 +01:00
parent 6e89a9a5ad
commit 4abb60fe0c

View File

@@ -337,10 +337,12 @@ class BaseConvexOptimizer(BaseOptimizer):
ef.add_constraint(lambda x: x <= np.array([0.01, 0.08, ..., 0.5]))
:param new_constraint: the constraint to be added
:type constraintfunc: lambda function
:type new_constraint: callable (e.g lambda function)
"""
if not callable(new_constraint):
raise TypeError("New constraint must be provided as a lambda function")
raise TypeError(
"New constraint must be provided as a callable (e.g lambda function)"
)
if self._opt is not None:
raise exceptions.InstantiationError(
"Adding constraints to an already solved problem might have unintended consequences. "