Created
May 7, 2014 06:21
-
-
Save mozillazg/b75849f5a450a05deb19 to your computer and use it in GitHub Desktop.
This file contains 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
In [1]: class A(): | |
...: def __call__(self, *args, **kwargs): | |
...: return locals() | |
...: | |
In [2]: a = A() | |
In [3]: a() | |
Out[3]: {'args': (), 'kwargs': {}, 'self': <__main__.A instance at 0x281b2d8>} | |
In [4]: a(1) | |
Out[4]: {'args': (1,), 'kwargs': {}, 'self': <__main__.A instance at 0x281b2d8>} | |
In [5]: a(1,3) | |
Out[5]: {'args': (1, 3), 'kwargs': {}, 'self': <__main__.A instance at 0x281b2d8>} | |
In [6]: a(1, 3, c=4) | |
Out[6]: | |
{'args': (1, 3), | |
'kwargs': {'c': 4}, | |
'self': <__main__.A instance at 0x281b2d8>} | |
In [7]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment