简体   繁体   English

我对Python类和事件有疑问

[英]I have a question about Python Classes & Events

My understanding of python is limited. 我对python的了解有限。 In a different forum, someone asked about classes. 在另一个论坛中,有人问课程。 In my explanation, I said Classes contain 3 things: properties, methods, and events. 在我的解释中,我说过类包含3件事:属性,方法和事件。 While several agreed with my comment, one person said I was wrong, that python classes do not contain events. 尽管有些人同意我的评论,但有人说我错了,python类不包含事件。 So my question is simple. 所以我的问题很简单。 Do/can python classes contain events? python类可以包含事件吗?

thank for taking the time to set me straight. 感谢您抽出宝贵的时间使我直率。

Python classes have methods and properties. Python类具有方法和属性。

Events can be implemented in Python using the Observer pattern. 可以使用Observer模式在Python中实现事件。

This blog has a nice example of implementing events in Python. 该博客提供了一个用Python实现事件的好例子。 https://sourcemaking.com/design_patterns/observer/python/1 https://sourcemaking.com/design_patterns/observer/python/1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM