[英]What does @ do in Python 3 (Pyglet)?
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. 当我注意到这段代码未在页面上进行记录时,我正在通过本教程尝试Pyglet。我也无法通过搜索网络在其中找到任何内容。
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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.