python继承
- 子类调用父类的方法
# 1
class SSHConnectionCache(ConnectionCache):
def __init__(self):
ConnectionCache.__init__(self, no_current_msg='No open connection.')
# 2
class SSHConnectionCache(ConnectionCache):
...
def get_connection(self, alias_or_index=None):
connection = super(SSHConnectionCache, self).get_connection(alias_or_index)
if not connection:
raise RuntimeError("Non-existing index or alias '%s'." % alias_or_index)
return connection