If you're having trouble accessing Google Search, please click here, or send feedback.
Python Performance Tips このページはPythonプログラムの実行効率を改善するさまざまなTipsやトリックの紹介に特化しています。誰から得た情報であっても、その情報源を紹介するつもりです。 "fast python"ページをはじめて書いた1996年以降も、Pythonは著しく変化してきました。このことは、幾つかの規則も変化しているということを意味しています。そこで、他の誰かがこのページのメンテナンスを手伝ってくれるという期待をもって、ページをPython wikiに移動させました。 注意:これらのTipsはいつでも、読者のアプリケーションや、実際に使用するバージョンのPythonで盲目的に受け入れるだけでなく、実際に試してみることができます。 これらの新しく独自に書かれたパッケージ、例えば Pyrex 、 Psyco 、 Weave や PyInline のようなも
Python & Java A Side-by-Side Comparison Stephen Ferg Home Updated: 2007-05-01 For best results when printing, set your browser's font size to SMALLEST before printing. This work is licensed under the Creative Commons Attribution 2.0 License You are free to copy, distribute, and display the work, and to make derivative works (including translations). If you do, you must give the ori
1. 初めに この文書の目的は、 Python で自前の class を作るとき、メソッドの第一引数がそのクラスのインスタンスそれ自身 (一般に self と書かれる) であることの理由を説明することです。 他の言語ではメソッドを定義するときに第一引数をインスタンスにするという方法は取り入れておらず、 this などの予約語を使ってインスタンスを表すのが一般的です。 Python だけが、独自の流儀をとっています。 しかし、このことを説明したサイトは見当たりませんでした。 どのサイトもそれは決まりごとだで済ませてしまっています。 しかし、それではどうも Python のクラスシステムを理解した気になれないので、Python でクラスシステムが どのように実装しているか推測しながら、例の self について説明したいと思います。 2. オブジェクト指向プログラミングの復習 オブジェクトとは、
The Python IAQ: Infrequently Answered Questions by Peter Norvig Q:Infrequently Answered Questionって何ですか? ある種の質問は、答えを知る人がほとんどいない、あるいはポイントが曖昧である、理解しづらい問題であるという理由によって(とはいえ、あなたにとってはとても重要なものかもしれません)、めったに答えられることがありません。 Java_IAQ のために、このIAQという用語を作ったのですが、それはとても有名な、 About.comの都市伝説リスト でも見つけられます。PythonのFAQはたくさん見つかりますが、Weiyang Chenによる、 このページの中国語訳 を除けば、これは唯一のIAQです(FAQリストのいくつかには、 C への皮肉が含まれています)。 Q:finally節内のコードの
ホットトピックス インスタは批判の嵐、YouTubeは強化、TikTokは鈍化。大混戦「短編動画」市場のゆくえ
Years ago John Aycock's SPARK introduced the idea of using docstring to store the pattern and rule definitions for a parser generator. Rather, that's where I first heard of it; someone else could have been first. Here's part of the scanner definition from Biopython for parsing GenBank locations: def t_caret(self, input): r" \^ " self.rv.append(Token("caret")) def t_comma(self, input): r" \, " self
[[ Spyce ]] Web development is fun again! Spyce will not waste your time with Clunky code reuse constructs XML, YAML, or a templating language you've never seen before; everything is Python Manually accessing GET and POST page parameters Writing boilerplate code for form validation Editing multiple files for each user-visible page Writing SQL queries by hand Rolling your own authentication framewo
rubyco(るびこ)の日記 - 呼び出し側のアスタリスクを読んで、「あ、そうか、それを使えば頭から二つずつ取ることができるか」とGame Scripting Memo - 続・パスカルの三角形のことを思い出しました。 >>> def get2(f, a, b, *rest): result = [f(a, b)] if rest: result += get2(f, *rest) return result >>> from operator import add >>> def dup(aList): return reduce(add, [[v, v] for v in aList]) >>> dup([1,2,3]) [1, 1, 2, 2, 3, 3] >>> def sandwich(bread, meat): return [bread] + meat + [bread] >
驚きました。 rubyco(るびこ)の日記 - デフォルト引数は明示的に評価されると同じことをPythonで書いた場合、関数定義の時点で評価されます。 >>> def default(n): print "default", n return n + 1 >>> def foo(x, y = default(5)): print x, y default 5 Rubyでは関数が呼ばれた時にデフォルト引数を評価するようです。しかも遅延評価とかではないようで、何度も関数を呼べば何度も実行されます。つまりPythonで書けば >>> def foo(x, y = None): if y == None: y = default(5) print x, y に相当する状態のようです。
Many people use Python because, like other scripting languages, it is a portable, platform-independent and general-purpose language that can perform the same tasks as the database-centric, proprietary 4GL tools supplied by database vendors. Like 4GL tools, Python lets you write programs that access, display and update the information in the database with minimal effort. Unlike many 4GLs, Python al
沖ソフトウェア株式会社は、沖通信システム株式会社および株式会社沖インフォテックと平成22年10月1日をもって合併いたしました。新会社名は、株式会社OKIソフトウェアとなります。3社が行っております事業は新会社にて従来通り継続いたします。
Closures in Python (part 1) Martin Fowler (obligitary Fowlbot namedrop) recently blogged about the power of closures in languages that support them. Here's a translation of Martin's Ruby code into Python. [Initial sentence and table structure copied from Joe Walnes] (not knowing how to get this to format correctly is my fault. I want to write a part 2, but that'll have to wait as I have other comm
How to Think Like a Computer Scientist Learning with Python 2nd Edition by Jeffrey Elkner, Allen B. Downey and Chris Meyers illustrated by Udit Bhatnager and Chris Schmeelk Foreword Preface Contributor List Chapter 1 -- The way of the program Chapter 2 -- Variables, expressions, and statements Chapter 3 -- Functions Chapter 4 -- Conditionals Chapter 5 -- Fruitful functions Chapter 6 -- Iteration
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く