Created
January 27, 2015 09:17
-
-
Save bcho/8f0907949efff4302e41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class A(object): | |
| bounded_lambda = lambda x: x | |
| def __init__(self, unbounded_lambda): | |
| self.unbounded_lambda = unbound_lambda | |
| def __call__(self): | |
| print(self.bounded_lambda, self.unbounded_lambda) | |
| # Cannot run this: | |
| # self.bounded_lambda('just one argument') | |
| A(lambda x: int(x))() | |
| # output: | |
| # <bound method A.<lambda> of <__main__.A object at 0x10da394a8>> <function <lambda> at 0x10d898b70> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment