1
Galera was studying python and saw on a site this line :
self.brotcl.plugins.runCustumcomand()
I know that self is referencing a class but and these three variables together as well ?
1
Galera was studying python and saw on a site this line :
self.brotcl.plugins.runCustumcomand()
I know that self is referencing a class but and these three variables together as well ?
4
self is referencing the object itself that has an attribute called brotctl.
self.brotctl is an object that has the attribute plugins.
Likewise, self.brotctl.plugins is an object that has the method runCustomcomand.
An example of implementation for what you present would be:
class Plugins:
def runCustomcomand(self):
pass
class Brotctl:
def __init__(self):
self.plugins = Plugins()
class Exemplo:
def __init__(self):
self.broatctl = Broatctl()
def run(self):
self.broatctl.plugins.runCustomcomand()
Browser other questions tagged python
You are not signed in. Login or sign up in order to post.