はじめに こんにちは、Python界の炭酸x2倍のジョルトコーラです。なんか適当に書いたコードが予想外にはてブ付いたので「みんな好きモノなんだなー」と思いました。同期なコードだとURL増えたときに詰まっちゃうので、非同期なやつもちょろっと紹介しますよ。 あ、くれぐれも闇雲なスクレイピングはしないでくださいよ。DoS攻撃と変わらないですから。捕まっても僕は責任とりませんよ。 リンク 5分でWebスクレイピングをする - YAMAGUCHI::weblog 前回のエントリ。これは直列なコードなのでURLが増えれば増えるほど線形に遅くなる。 やってみよう おさらい 前回は指定した複数のURLのページにあるHTMLからaタグを全部抜き出す、というようなことをしたのでした。で、今回はそれを非同期化しましょうという話。 非同期にしたいところ 前のコードでforとかになってるところは基本的に同期じゃなく
Abstract This document shows how Python fits into the web. It presents some ways to integrate Python with a web server, and general practices useful for developing web sites. Programming for the Web has become a hot topic since the rise of “Web 2.0”, which focuses on user-generated content on web sites. It has always been possible to use Python for creating web sites, but it was a rather tedious t
How To Make Your Own Text Adventure On A Computer Schnell Style (but in Python) If you have made a text adventure in your mind that you really like, and you're tired of dictating it and would rather make it in a computer language, this page is for you! I'm teaching you a shortcut to make a text adventure, for those who actually know Python. 1. Decide the map of your text adventure. Here are some t
When I was pointed to Python Deployment Anti-Patterns by a colleague I was a little shocked to see that the way we had been deploying applications with fabric and git over the past two years (over 1500 deployments) with no problems was being called an Anti-Pattern. There are definitely many ways to deploy software applications and they all have their pros and cons. Our process is by no means perfe
Improving your code with modern idioms¶ Once you have added Python 3 support you have a chance to use the newer features of Python to improve your code. Many of the things mentioned in this chapter are in fact possible to do even before adding Python 3 support, as they are supported even by quite old versions of Python. But I mention them here anyway, because they aren’t always used when the code
環境 この記事の内容は、Python 2.4.4c1, Twisted 2.4.0-1で確認しました。 疑問点 Twistedのソースコードを読んでいたら、以下のような記述を見つけました。ファイルは、/usr/lib/python2.4/site-packages/twisted/internet/defer.pyです。 def _runCallbacks(self): : callback, args, kw = item[ isinstance(self.result, failure.Failure)] ここで、itemは配列です。配列ですが、インデックスには数値ではなく、TrueまたはFalseであるisinstance関数の戻り値を与えています。なぜこんなことが可能なのか、調べてみました。 結論 TrueとFalseは整数であり、Trueは1, Falseは0です。 詳細 現象か
Proceedings of the 6th International Python Conference Design Patterns in Python Vespe Savikko Software Systems Laboratory Tampere University of Technology FIN-33101 Tampere, Finland vespe@cs.tut.fi Abstract The choice of implementation language affects the use of design patterns. Naturally some languages are better applicable for different tasks than others. Each language has its own set of
Fabric, Cuisine and Watchdog for server administration in PythonAI-enhanced description The document details the use of Python libraries Fabric, Cuisine, and Watchdog for server administration and application deployment. It discusses the shift from dedicated servers to virtual servers and the need for efficient server setup, management, and configuration. Fabric simplifies SSH interactions, while
概要¶ これは Google Python Style Guide Revision 2.29 を日本語に訳したものです。 本家ガイドは CC-By 3.0 ライセンス の基で公開されています。また、本ガイドも同ライセンスを継承します。 本家ガイドの著者は以下の通りです。 Amit Patel Antoine Picard Eugene Jhong Jeremy Hylton Matt Smart Mike Shields また、本ガイドの翻訳者は以下の通りです。 Kosei Kitahara 本ガイドに誤植、誤訳があった場合は issue で教えてください。 その他本ガイドに関する問い合わせは、サイト最下部に記載のメールアドレスか @Surgo にお願いします。 はじめに¶ Python は Google で使われている主要なスクリプト言語です。 このスタイルガイドは Python によ
Glossary¶ >>>¶The default Python prompt of the interactive shell. Often seen for code examples which can be executed interactively in the interpreter. ...¶Can refer to: The default Python prompt of the interactive shell when entering the code for an indented code block, when within a pair of matching left and right delimiters (parentheses, square brackets, curly braces or triple quotes), or after
モジュールpdbはPythonプログラム用の対話的ソースコードデバッガを定義します。(条件付き)ブレークポイントの設定やソース行レベルでのシングルステップ実行、スタックフレームのインスペクション、ソースコードリスティングおよびいかなるスタックフレームのコンテキストにおける任意のPythonコードの評価をサポートしています。事後解析デバッギングもサポートし、プログラムの制御下で呼び出すことができます。 デバッガは拡張可能です -- 実際にはクラスPdbとして定義されています。現在これについてのドキュメントはありませんが、ソースを読めば簡単に理解できます。拡張インターフェースはモジュールbdb(ドキュメントなし)とcmdを使っています。 デバッガのプロンプトは"(Pdb) "です。デバッガに制御された状態でプログラムを実行するための典型的な使い方は: >>> import pdb >>> im
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く