CodeZine編集部では、現場で活躍するデベロッパーをスターにするためのカンファレンス「Developers Summit」や、エンジニアの生きざまをブーストするためのイベント「Developers Boost」など、さまざまなカンファレンスを企画・運営しています。
What’s New In Python 3.3¶ This article explains the new features in Python 3.3, compared to 3.2. Python 3.3 was released on September 29, 2012. For full details, see the changelog. Summary – Release highlights¶ New syntax features: New yield from expression for generator delegation. The u'unicode' syntax is accepted again for str objects. New library modules: faulthandler (helps debugging low-leve
written on June 22, 2012 I admit that I was a huge fan of the Python setuptools library for a long time. There was a lot in there which just resonated with how I thought that software development should work. I still think that the design of setuptools is amazing. Nobody would argue that setuptools was flawless and it certainly failed in many regards. The biggest problem probably was that it was b
複数の Python バージョンでテストを実行するツールに tox があります。 tox と pytest で Python 2/3 両対応のテストを実行する - forest book tox ツールそのものがとても便利なのですが、この tox テストを並列実行してくれるツールがリリースされました。 detox: Python Package Index 既に tox を使っている環境であれば、detox をインストールするだけで良いです。 $ pip install detox 使い方は tox と全く同じで特別な設定は不要です。tox コマンドを実行する代わりに detox コマンドを実行します。試しに実行してみましょう。 (test)$ detox py26 create: /Users/t2y/work/repo/littlehttpserver/.tox/py26 GLOB s
by Dan Crosta Pop quiz: how would you implement Python's xrange (known in Python 3.x as range) in Python and without making a list or any other sequence type? If you answered "with a generator," you'd be wrong! And it's likely because you've only ever used an xrange in code like: In this case (where the xrange is only used as an "argument" to a for loop), a generator would probably suffice. But, i
Here is a handy Python Timer class. It creates a context manager object, used for timing a block of code. from timeit import default_timer class Timer(object): def __init__(self, verbose=False): self.verbose = verbose self.timer = default_timer def __enter__(self): self.start = self.timer() return self def __exit__(self, *args): end = self.timer() self.elapsed_secs = end - self.start self.elapsed
Django で Ruby on Rails の scaffold 的なことをする『django-generate-scaffold』を使ってみる。 (Python==2.7, Django==1.4, django-generate-scaffold==0.0.3a1) Install: django-generate-scaffold $ pip install django-generate-scaffold startproject $ django-admin.py startproject ownsomeblog $ cd ownsomeblog/ $ python manage.py startapp blogs $ ls blogs/ manage.py ownsomeblog/ settings.py ownsomeblog/settings.py SQLite3 設定。
Supervisor: A Process Control System¶ Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems. It shares some of the same goals of programs like launchd, daemontools, and runit. Unlike some of these programs, it is not meant to be run as a substitute for init as “process id 1”. Instead it is meant to be used to control
MongoDB使ってますかー?便利ですよー? 最近、位置情報を処理するのにこのMongoDBを使っています。何故Mongoかと言うと 「この位置から500m以内の施設情報をヨコセ」 といった検索が超簡単にできるから。 論より証拠。 MongoDBには[緯度、経度]といった配列を含むデータをつっこんでおきます。こんな感じ。 [js] db.test.save({‘id’:’hoge’, ‘place’:’新宿駅’, ‘loc’:[35.690921, 139.700258]}); db.test.save({‘id’:’hoge’, ‘place’:’スタジオアルタ’, ‘loc’:[35.69271580036533, 139.70121502876282]}); db.test.save({‘id’:’test’, ‘place’:’東京都庁’, ‘loc’:[35.6894743099
Python のテストツールに pytest があります。ここ最近、徐々にテストを書くのに慣れてきて、さらにテスト設計や知見を高めようという思いが強くなってきました。 pytest は、wikipedia:設定より規約 を設計原則とするツールです。Python は明示する文化なのでやや違和感を感じる人もいるかもしれません。さらに xUnit スタイルではない funcarg という関数の引数をフックしてリソースインジェクションを行う仕組みを提供するなど、私にとっては新たな概念を学ぶのにおもしろそうな題材に見えました。 Holger Krekel 氏と出会い 先日 PyCon US 2012 に参加して、pytest の作者 Holger Krekel 氏と出会い、話すことができました。 最初に会ったのはカンファレンスが始まる前日のチュートリアルデーで、手持ち無沙汰な様子に見えたので、ランダ
承前:Pythonのデコレータ(decorator)を理解する 1 デコレータ詳説 先の例に対して、デコレータ構文を使うと次のようになる: @my_shiny_new_decorator def another_stand_alone_function(): print "Leave me alone" another_stand_alone_function() #出力: #Before the function runs #Leave me alone #After the function runs そう、これで全部、シンプルだ。@decoratorは単なる、 another_stand_alone_function = my_shiny_new_decorator(another_stand_alone_function) のショートカットにすぎない。Decoratorはデザインパ
StackOverFlow:Understanding Python decoratorsに対するe-satis氏によるデコレータの丁寧な解説。 一つエクスキューズしておくと、翻訳の作法とかよく分かってません。でも頑張ったつもり。つもり。 Imran氏による質問の内容 @makebold @makeitalic def say(): return "Hello" というデコレータに対して <b><i>Hello</i></b> という文字列を返すような関数ってどうやって書いたらいいの? e-satis氏による解説 Pythonの関数はオブジェクトである デコレータを理解するためには、まずPythonにおける関数がオブジェクトであることを理解しなければならない。このことは重大な影響をもたらす。なぜなのか簡単な例とともに見てみよう。 def shout(word="yes"): return
Welcome to Djangosnippets.org, a site for users of the Django web framework to come together and share useful "snippets" of reusable code. If you're just here to browse, you can look through snippets organized by author, by language or by tag. You can also have a look at the top-rated snippets and the most-bookmarked snippets. If you'd like to contribute, sign up for a free account and you'll be a
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く