paltman (owner)

Fork Of

Revisions

gist: 86496 Download_button fork
public
Public Clone URL: git://gist.github.com/86496.git
Embed All Files: show embed
Python #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class kewlness(object):
    def __init__(self, func):
        self.func = func
    def __call__(self, *args, **kwargs):
        if len(args) > 0:
            self.new_thing = args[0]
        return self.func(*args, **kwargs)
    def __repr__(self):
        return self.func.__doc__
 
 
@kewlness
def testmeyo(*args):
    pass
    # so how do i get "new_thing" attribute to print?
 
 
if __name__=='__main__':
    testmeyo("should_be_value_of_new_thing")
    print testmeyo.new_thing