Pythonの禅(PEP 20):エレガントなコードのための19の不変原則
最も初期のPython PEPの一つがPEP-20です。これはPythonプログラミングに関する19のテーゼのリストで、「Pythonの禅(The Zen of Python)」と呼ばれています。これらのルールは2004年に遡り、PEP-8に基づいています。
Pythonに長く存在する小さなイースターエッグで、これら19のルールを表示できます:
>>> 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!
Python REPLさえあれば、いつでもこれらのルールを画面に表示できます!
Python
- B&R mapp Motion、高度な設定機能でロボット性能を強化
- サプライチェーンの未来対応:レジリエンスと成長のための戦略
- パンデミック下での必需品共同調達:病院サプライチェーンの連携
- IoTがHVACに革命をもたらす:5つの主要な改善点
- IoTへの洞察を深める:データ可視化とグラフデータベースの活用
- コネクテッドカーが車両安全性とメンテナンスをどう変革するか
- Python データ型マスター: 実践ガイド
- Python 演算子完全マスター: 包括的ガイド
- Pythonリスト操作:作成、アクセス、変更、高度なテクニック
- Pythonタプル完全ガイド:作成、アクセス、高度な操作
- Python辞書完全ガイド:作成、操作、高度なテクニック