Created
November 1, 2014 04:32
-
-
Save Excedrin/49c0a0c850f6e5015026 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
def selfdec(f): | |
def dec(*x, **kwa): | |
f.__globals__['self'] = x[0] | |
return f(*x[1:], **kwa) | |
return dec | |
class X(): | |
@selfdec | |
def z(more, args, even="opt"): | |
self.hurr = 3 | |
return "%s: %d" %(even, self.hurr + more + args) | |
a = X() | |
print a.z(1,2,even="test") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment