ループの中でループを回す処理は読みにくい 例えば友達が5人いて、サンドイッチが3種類あって、2種類の飲み物を配る処理を作るとします。 こういう場合、for文を何段にもネストするプログラムを書かざるを得ないときがありますよね。 for friend in friends: for sandwich in sandwiches: for drink in drinks: do_something(friend, sandwich, drink) そもそも、こういうプログラムを書く前は、本当にそういう処理で正しいのか考えた方がいいですが、とにかくこんなコードは読みにくいです。 ループの中でループを回すプログラムを字下げして書くことが読みにくさに寄与していると思うのですが、pythonだと字下げは必須なので悩ましいものです。 itertools.productを使えば絶対に1段で書ける しかし、こ
Welcome to Flask¶ Welcome to Flask’s documentation. Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. Get started with Installation and then get an overview with the Quickstart. There is also a more detailed Tutorial that shows how to create a small but complete application with Flask.
Pythonには "Zen of Python"という、Pythonの設計原則を簡潔に20個の格言にまとめたものがあります。それを単純に翻訳しても伝わりにくいだろうなぁと思ったので、訳注をたくさんつけて翻訳してみました。 美は醜より良い 明示は暗黙より良い 単純は複雑より良い 複雑なほうが理解しにくいよりは良い *1 平坦は入れ子より良い 疎は密より良い *2 読みやすさが重要 「特殊なケース」はルールを破るほど特殊ではない*3 しかし、実利は純粋さより重要 *4 エラーを黙って通してはいけない ただし、明示的に黙らせた場合は別 *5 曖昧さに面したら、正解を推測したくなる誘惑を退けよ *6 一つの明確なやり方があるべきだ。そしてただ一つであることが望ましい。 *7 しかし、その方法はオランダ人以外にはとっつきにくいかもね *8 今やる方がやらないより良い しかし、やらないほうが、今 *す
Overview¶ FriendFeed’s web server is a relatively simple, non-blocking web server written in Python. The FriendFeed application is written using a web framework that looks a bit like web.py or Google’s webapp, but with additional tools and optimizations to take advantage of the non-blocking web server and tools. Tornado is an open source version of this web server and some of the tools we use most
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く