What does @class mean in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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?

29th Aug 2021, 12:06 AM
⊹≒tɧε8шσσɖɕนttεг≓⊹
⊹≒tɧε8шσσɖɕนttεг≓⊹ - avatar
2 Answers
+ 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
29th Aug 2021, 2:56 AM
BroFar
BroFar - avatar
+ 1
Okay so then @className instantiates the class for use, using its constructor? I seem to have been out of the loop with OOP
31st Aug 2021, 5:40 PM
⊹≒tɧε8шσσɖɕนttεг≓⊹
⊹≒tɧε8шσσɖɕนttεг≓⊹ - avatar