Programmer's Gate /Effective Python Effective Python Pythonの基本を一通り勉強した人が次に読む記事を目指して書く予定。 Python 2.5を対象とする。
このブログは自宅サーバ(Gentoo Linux)で動いています。 DBのバックアップがちゃんとできていなくて、古い記事が全部消えてしまいましたorz typo 5.0.2に更新しました。 Posted by Hakuja Wed, 21 Mar 2007 15:39:00 GMT Djangoをちょっと触ってるんですが、Python自体まだ使いこなせてないので、いろいろとつっかかります。 標準ライブラリのdatetime.timedeltaというクラスで、日付の演算ができるのですが、例えば月の演算なんかはできませんでした。 Cheese Shop でdateutil というのを見つけて、自分のやりたいことができました。 from datetime import * today = date.today() today # => datetime.date(2007, 3, 22) fro
IOモナドは難しそうだったのでとりあえずMaybeモナドからはじめる。 >>> def Maybe(typ): class Foo(object): @classmethod def return_(_, x): return Just(x) @classmethod def bind(_, m, f): if isinstance(m, Nothing): return Nothing() elif isinstance(m, Just): return f(m.value) class Just(object): def __init__(self, x): assert isinstance(x, typ) self.value = x class Nothing(object): pass Foo.__name__ = "Maybe_%s" % typ.__name__ retur
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 import sgmllib, string class StrippingParser(sgmllib.SGMLParser): # These are the HTML tags that we will leave intact valid_tags = ('b', 'a', 'i', 'br', 'p') from htmlentitydefs import entitydefs # replace entitydefs from sgmllib de
Character encoding auto-detection in Python. As smart as your browser. Open source. >>> import urllib >>> urlread = lambda url: urllib.urlopen(url).read() >>> import chardet >>> chardet.detect(urlread("http://google.cn/")) {'encoding': 'GB2312', 'confidence': 0.99} >>> chardet.detect(urlread("http://yahoo.co.jp/")) {'encoding': 'EUC-JP', 'confidence': 0.99} >>> chardet.detect(urlread("http://amazo
もしあなたが美しい(あるいはトリッキーな)コードが飛び交う世界を知りたいと願うならそれはTopCoderに参加することで容易に実現することができる。このTopCoderに参加している数少ない日本人で、生涯プログラマーを宣言する人物にTopCoderの魅力を聞いた。 世にハッカーと呼ばれる人は数多く存在すれど、日常生活においてわたしたちがそうした人たちのコーディングを目の当たりにする機会はまれである。 しかし、美しい(あるいはトリッキーな)コードが飛び交う世界を知りたいと願うならそれは容易に実現することができる。そこには国籍、年齢、過去の栄光……そのいずれもが何の意味も持たない、コードのみが支配する世界が広がっている。 そんな世界の1つとしてTopCoderが挙げられる。世界中からトップレベルのプログラマーが参加するプログラミングコンテストとして知る人ぞ知るTopCoder。日本ではいまひと
Python Call Graph¶ Welcome! Python Call Graph is a Python module that creates call graph visualizations for Python applications. Screenshots¶ Click on the images below to see a larger version and the source code that generated them. Project Status¶ The latest version is 1.0.1 which was released on 2013-09-17, and is a backwards incompatbile from the previous release. The project lives on GitHub, w
This webpage was generated by the domain owner using Sedo Domain Parking. Disclaimer: Sedo maintains no relationship with third party advertisers. Reference to any specific service or trade mark is not controlled by Sedo nor does it constitute or imply its association, endorsement or recommendation.
タプル(英: tuple、英語発音: [tʌp(ə)l, tuːp(ə)l]、タプル、トゥープル)とは、複数の構成要素からなる組を総称する一般概念であり、カタカナ語としては主に計算機科学において順序付けられた対象の並びを表すために用いられる。n 個でできた組を英語で「n-tuple」と書くことに由来し、数学では日本語に訳す場合、通常「n 組」とし、タプルの概念そのものも組と呼ばれる。なお、 n-tuple は数学のタプルを意味するほか、同様に double、triple などの拡張として倍数詞の表現にも利用される(詳細は「倍#西洋数学における n 倍を表す表現」を参照)。 集合論では n 組 (n-tuple) とは n 個の対象 a1, a2, ..., an の順序づけられた組であり、普通、括弧でくくって (a1, a2, a3, ..., an) のように書かれる。 タプルが順序づけ
スクリプト言語用のデバッガの使い方 - Ruby, Python, Perl スクリプト言語用の CUIのデバッガの使い方を簡単にまとめました。対象言語は Ruby, Python, Perl です。 私は C, C++ でプログラムを書いているときはデバッガ (主に GNU/Linux 上の gdb) を頻繁に利用します。しかし、スクリプト言語ではそれほどでもありません。これはおそらく次のような理由によります。 ビルドが不要なので printf デバッグが容易 (ある程度大きい C++ のプログラムではビルド時間が長いので printf の挿入はしんどい) 異常終了時にスタックトレースが表示される (Ruby, Python なら自動、Perl の場合は use Carp; $SIG{__DIE__} = \&Carp::confess; など) オブジェクトのインスペクトが簡単 (Ru
Brief Description Pyrex lets you write code that mixes Python and C data types any way you want, and compiles it into a C extension for Python. Documentation About Pyrex Language Overview FAQ Contributed by Users Quick Guide to Pyrex Contributed by Michael JasonSmith. If the above link doesn't work, there is a copy here. Embedding Pyrex Using Pyrex to write stand-alone programs that embed a Python
Laurent Pointal¶ Service d'Administration des Moyens Informatique (SAMI) du LISN Contacts Email : laurent.pointal@lisn.fr Téléphone : +33 (0)1 69 15 80 99 Courrier : Laurent Pointal — LISN/SAMI Campus universitaire bât. 507 Rue du Belvedère F - 91400 Orsay Bureau : Orsay, Campus universitaire bât. 508 rue John-von-Neumann, RdC, porte 4 LinkedIn / Twitter-X / Facebook / TikTok / Instagram / WhatsAp
PyDEVは、EclipseでPythonやJythonのプログラムを開発するためのプラグインだ。これを使うと、Eclipseが、コードの補完、構文の強調、構文解析、自動リファクタリング、テンプレート・システム、ソースコード品質チェック、デバッグ環境などの機能を備えた第一級のPython統合開発環境になる。 PyDEVを利用するにはEclipseとPythonがインストールされている必要があるが、Windows、Linux/Unix、Mac OS Xなどといった通常のプラットフォームであれば、Java(EclipseはJavaで書かれている)とPythonはほとんどの場合に動作する。したがって、PyDEVはほぼすべてのOS上で利用可能だ。Eclipse上で、メニューからHelp→Software Updates→Find and Installの順に選択する。次いで、Search for
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く