secretbase.log

.NET/C#/Pythonなど

全てのエンジニアがPythonを勉強するべき2013年到来

2013年は、巳年です。ヘビといえばPython(ニシキヘビ)ですね。
http://www.python.org/images/python-logo.gif

Python をはじめよう

Python を初めてない人は初めてみるのもよいと思いますので、まずは下記の記事を読んでやる気を出しましょう。

Python の哲学

これも有名なものですが、 python インタプリタ上で import this を実行すると 表示されます。

$ python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
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!
>>>

import this は、this.py というライブラリが ソースコードで提供されています。

import this - Project Purity で 暗号化された this のメッセージを解読しようという試みがされており面白いです。遊びゴコロが伺えますね。

Pythonソースコード入手

Python の実行系で使われている C言語版は、cpython と呼ばれており、Mercurialソースコード管理されています。

$ hg clone http://hg.python.org/cpython

オススメの書籍

初めてPython に触るためには、下記 3冊がオススメです。

Pythonスタートブック

Pythonスタートブック


みんなのPython 第3版

みんなのPython 第3版


初めてのPython 第3版

初めてのPython 第3版


興味が出てきたら下記本に手を出すと良いでしょう。

エキスパートPythonプログラミング

エキスパートPythonプログラミング


Pythonプロフェッショナルプログラミング

Pythonプロフェッショナルプログラミング