開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python 3.4 (プログラミング言語)
Learning Python (Mark Lutz (著)、Oreilly & Associates Inc)のPART Ⅲ.(Statements and Syntax)、Chapter 15.(The Documentation Interlude)、Test Your Knowledge: Quiz 2.を解いてみる。
その他参考書籍
- Pythonチュートリアル 第2版
- Python クックブック 第2版 (原書(最新版))
- Programming Python
- Python Pocket Reference (Pocket Reference (O'Reilly))
Test Your Knowledge: Quiz 2.
コード(BBEdit)
sample2.py
#!/usr/bin/env python3 #-*- coding: utf-8 -*- """ module documentation strings """ class A: """ class documentation strings """ def method(self): """ method documentation strings """ pass def f(): """ function documentation strings """ pass
入出力結果(Terminal, IPython)
$ ipython Python 3.4.2 (default, Oct 9 2014, 11:02:09) Type "copyright", "credits" or "license" for more information. IPython 2.3.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: import sample2 In [2]: help(sample2) Help on module sample2: NAME sample2 DESCRIPTION module documentation strings CLASSES builtins.object A class A(builtins.object) | class | documentation strings | | Methods defined here: | | method(self) | method | documentation strings | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) FUNCTIONS f() function documentation strings FILE /Users/kamimura/Documents/py/learning_py_en/part3/ch15/sample2.py In [3]: print(sample2.__doc__) module documentation strings In [4]: print(sample2.A.__doc__) class documentation strings In [5]: print(sample2.A.method.__doc__) method documentation strings In [6]: print(sample2.f.__doc__) function documentation strings In [7]: quit() $ pydoc3.4 sample2 Help on module sample2: NAME sample2 DESCRIPTION module documentation strings CLASSES builtins.object A class A(builtins.object) | class | documentation strings | | Methods defined here: | | method(self) | method | documentation strings | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) FUNCTIONS f() function documentation strings FILE /Users/kamimura/Documents/py/learning_py_en/part3/ch15/sample2.py $
0 コメント:
コメントを投稿