- Python : 3.7.0
- OS : Ubuntu 18.04.1 LTS
- IDE : PyCharm 2018.2.4
- Conda : 4.5.11
- typesetting : Markdown
""" @Author : 行初心 @Date : 18-9-23 @Blog : www.cnblogs.com/xingchuxin @Gitee : gitee.com/zhichengjiu """ class Father: pass class Son(Father): pass class GrandSon(Son): pass class MyClass: pass def main(): print(issubclass(MyClass, object)) print(issubclass(MyClass, GrandSon)) print(issubclass(GrandSon, (Son, MyClass))) print(issubclass(MyClass, MyClass)) if __name__ == '__main__': main()
/home/coder/anaconda3/envs/py37/bin/python /home/coder/PycharmProjects/oop/demo.py True False True True Process finished with exit code 0
Python具備開源、跨平臺、解釋型、交互式等特性,值得學習。
Python的設計哲學:優雅,明確,簡單。提倡用一種方法,最好是隻有一種方法來作一件事。
代碼的書寫要遵照規範,這樣有助於溝通和理解。
每種語言都有獨特的思想,初學者須要轉變思惟、踏實踐行、堅持積累。python