You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classconstant:
""" Returns a function that no matter the arguments always returns self.value. """def__init__(self, value):
self.value=valuedef__call__(self, *args, **kwargs):
returnself.value
This one is good for whenever you want a constant value but some other function requires a function as input. E.g.
Drop here new function proposals.
Here is one:
This one is good for whenever you want a constant value but some other function requires a function as input. E.g.
This differ from doing
lambda: 0
since that one would require zero arguments and would crash in this caseThe text was updated successfully, but these errors were encountered: