2008-01-11から1日間の記事一覧

クラスを定義する

>>> class Point: # クラス定義の開始 ... format = "%s [X:%s Y:%s]" # クラス変数 ... ... def __init__(self, x, y): # メソッドの定義 ... self.str = "Point" # インスタンス変数 ... self.set(x, y) ... ... def set(self, x, y): ... self.__x = int(…