문제

I was trying out Pyglet via this tutorial when I noticed this portion of the code, which is not documented on the page.. I have not been able to find anything on it by searching the web either.

What exactly does it do? Can it be used with other objects?

    @window.event
도움이 되었습니까?

해결책

It "decorates" the following function/method/class

@window.event
def f(foo):
    return bar

Is equivalent to

def f(foo):
    return bar
f = window.event(f)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top