2012年3月8日木曜日

開発環境

『初めてのPython 第3版』(Mark Lutz 著、夏目 大 訳、オライリー・ジャパン、2009年、ISBN978-4-87311-393-7)のI部(Pythonの基礎知識)1章(PythonについてのQ&Aの問題を解いてみる。

1.

Pythonを使うメリットは、

  1. ソフトウェアのクオリティ
  2. 生産性の高さ
  3. ポータビリティ
  4. 充実したライブラリ
  5. コンポーネントの統合が容易
  6. プログラミングが楽しい

の6つ。

2.

Pythonを使用している有名な企業、団体は、

  • Google
  • YouTube
  • NASA
  • Intel
  • IBM

など多くの企業、団体がある。

3.

Pythonに欠点があるとすれば、C/C++等のコンパイラ言語に比べて実行速度が落ちる場合があること。

4.

Pythonを使うとコンピュータでできるほとんど全てのことが出来る。

5.

実際にコマンドを使ってみる。

入出力結果(Terminal)

$ python
Python 2.7.2 (default, Feb 12 2012, 23:50:38) 
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>> quit()
$

ということで、import thisというコマンドでPythonの基本思想を詳しく知ることが出来る。

6.

この本のコード例に頻繁に"spam"という言葉が出てくるのは、Pythonという名前が英国のBBCのコメディ番組「Monty Python's Flying Circus」にちなんでいるから。

0 コメント:

コメントを投稿