class_demo10.py
"""An example of the Demo class.
This module demonstrates the docstring.
"""
# This is a comment of a class.
class Demo:
"""A docsting of the class."""
# This is a comment of the method.
def __init__(self, v1=11, v2=22):
"""A docsting of the __init__."""
self.__a = v1
self.__b = v2
# This is a comment of a method.
def do_something(self):
"""A docsting of a method."""
return self.__a + self.__b
if __name__ == "__main__":
d = Demo(12, 34)
print(d.do_something())
# 檔名: class_demo10.py
# 作者: Kaiching Chang
# 時間: July, 2014the end
沒有留言:
張貼留言
0.留言請選擇註冊帳號, Google 或 OpenID 均可
1.歡迎留言交流,但不歡迎垃圾留言及廣告留言
2.文章相關問題歡迎提出,請減少情緒性留言
3.非文章相關內容,請到 G+ 社群或 FB 社團提出
4.問作業之留言會被直接刪除
5.莫忘網路禮節
6.可使用部份HTML標記,如 <b> 、 <i> 、 <a>
7.站長保留刪除留言的權力