0
What does @class mean in python?
I am hoping to modify some plugins for the chatbot program written in python and reading some other code I see it included a class (import botcmd from BotPlugin) prefixed by an @ symbol. It starts on a newline (@botcmd) and in the same indent appears to associate the following code. What is this? I am used to php and I understand class inheritance but not class referencing, is that all it is?
2 Antworten
+ 3
A class is a code template for creating objects. Objects have member variables and have behaviour associated with them.
In python a class is created by the keyword class. An object is created using the constructor of the class. This object will then be called the instance of the class.
reference:
https://www.hackerearth.com/practice/python/object-oriented-programming/classes-and-objects-i/tutorial/
additionally this might be helpful:
https://docs.python.org/3/tutorial/classes.html
+ 1
Okay so then @className instantiates the class for use, using its constructor? I seem to have been out of the loop with OOP