私はPythonに非常に慣れていません.私はいくつかのPythonコードで作業しています.Pythonオブジェクト指向の概念をC++の概念にマッピングしようとしています.これは学習するのに良い方法だと思います.2種類のクラス定義にまたがることができます.
class SourcetoPort(Base):
""""""
__tablename__ = 'source_to_port'
id = Column(Integer, primary_key=True)
port_no = Column(Integer)
src_address = Column(String)
#----------------------------------------------------------------------
def __init__(self, src_address,port_no):
""""""
self.src_address = src_address
self.port_no = port_no
そして2つ目。
class Tutorial (object):
def __init__ (self, connection):
print "calling Tutorial __init__"
self.connection = connection
connection.addListeners(self)
self.mac_to_port = {}
self.matrix={}
SourcetoPort のベースとチュートリアルのオブジェクトの違いは何ですか?