- インスタンス生成時に new は不要。
- メソッドの第一引数には self を指定する(this の役割)。
- 文字列をクラス内にベタに定義すると、オブジェクトの説明を示す __doc__ 属性(docstring)になる。
#!/usr/bin/python # class Hoge: "Hoge is Test class." age = 19 def name(self): return "Hoge!" print "hello world" hoge = Hoge() print hoge.name() print hoge.age print hoge.__doc__
hello world
Hoge!
19
Hoge is Test class.