Проясните, пожалуйста. Есть класс ConnectionObject, унаследованный от класса Connection.
class ConnectionObject(Connection):
def authenticateWithPassword(self):
super(ConnectionObject, self).authenticateWithPassword(self.username, self.password)
def __init__(self, username, password):
super(ConnectionObject, self).__init__()
self.username = username
self.password = password
У родительского класса Connection есть метод
authenticateWithPassword(self, username, password). Следующий код
con = ConnectionObject(username, password)
con.authenticateWithPassword()
дает следующую ошибку
File “D:\developing\ide\projects\netbeans\jython\SshTest\src\sshhelper.py”, line 45, in get_connection
con.authenticateWithPassword()
File “D:\developing\ide\projects\netbeans\jython\SshTest\src\sshhelper.py”, line 16, in authenticateWithPassword
super(ConnectionObject, self).authenticateWithPassword(self.username, self.password)
TypeError: authenticateWithPassword() takes exactly 1 argument (3 given)
Т.е. такое впечатление, что ConnectionObject вызовом
super(ConnectionObject, self).authenticateWithPassword(self.username, self.password) обращается к самому себе. Если заменить эту строку на
Connection.authenticateWithPassword(self, self.username, self.password)
то работает. Почему не работает в первом случае и как правильнее?