Update from 2023: Node’s performance with async iterators has improved considerably since this post was written in 2017. See the async-iteration repo for updated performance stats. Text processing in node.js has historically been both slow and cumbersome. But don’t fret, there’s hope on the horizon! The new async iterators proposal solves the “cumbersome” problem brilliantly. But sadly, it misses
自分で小さいツールを作る時に心に留めているtipsです. 書き始めたときは「どうせ書捨てだし」と思って書き始めると意外と長い間,もしくはいろんなところで使うことになったりするので,気をつけておくと後から楽になるというような小技です.大規模なソフトウェアの開発ではまた違った流儀があると思います. メインルーチンを関数にする 関数名はなんでもいいのですが,自分は趣味で main() という名前の関数を用意し,メインルーチンは全てそこに書くようにしています. pythonの小さなサンプルコードを見たりすると関数外の部分にベタで実行コードが書かれていたりします.もちろんそれでも動くのですが,以下の2点で後々面倒になることがあります. グローバル変数だらけになり管理が追いつかなくなる:「どうせ小さなスクリプトだし」ではじめると最初は見通しが良くてもだんだんどこでどの変数名を使っているか分からなくなっ
There is no new project development happening at the moment, but it's not abandoned either. Pull requests and new maintainers are welcome. If you are a novice Python programmer, you don't like plumbing yourself or you don't have basic understanding of C, this project is not probably what you are looking for. Japronto (from Portuguese "já pronto" /ˈʒa pɾõtu/ meaning "already done") is a screaming-f
asyncio is an asynchronous I/O framework shipping with the Python Standard Library. In this blog post, we introduce uvloop: a full, drop-in replacement for the asyncio event loop. uvloop is written in Cython and built on top of libuv. uvloop makes asyncio fast. In fact, it is at least 2x faster than nodejs, gevent, as well as any other Python asynchronous framework. The performance of uvloop-based
Introduction An ASGI web server, for Python. Documentation: https://www.uvicorn.org Source Code: https://www.github.com/encode/uvicorn Uvicorn is an ASGI web server implementation for Python. Until recently Python has lacked a minimal low-level server/application interface for async frameworks. The ASGI specification fills this gap, and means we're now able to start building a common set of toolin
PEP 543 – A Unified TLS API for Python Author: Cory Benfield <cory at lukasa.co.uk>, Christian Heimes <christian at python.org> Status: Withdrawn Type: Standards Track Created: 17-Oct-2016 Python-Version: 3.7 Post-History: 11-Jan-2017, 19-Jan-2017, 02-Feb-2017, 09-Feb-2017 Superseded-By: 748 Table of Contents Abstract Resolution Rationale Problems Proposal Interfaces Configuration Context Buffer S
# sample.py import falcon class QuoteResource: def on_get(self, req, resp): """Handle GET requests.""" quote = { 'author': 'Grace Hopper', 'quote': ( "I've always been more interested in " "the future than in the past." ), } resp.media = quote app = falcon.App() app.add_route('/quote', QuoteResource()) $ pip install falcon gunicorn $ gunicorn sample:app Fast Falcon is a blazing fast, minimalist Py
機械学習ブームなどにより、 Python を触り始める Rubyist が増えてきたと思います。その際に問題になりやすいのが環境構築です。Rubyだと rbenv がデファクトスタンダードになっているのに、なぜか Python に… 私の立ち位置もともとは、数年前まで 年に一回Python3でNLTKやらscikit-learnやら機械学習や自然言語処理の環境を作ろうと試みては失敗してPython使うものかと思っていた人でした。それが、Anacondaで環境導入すると、面倒なことは何も考えずに済むということを知り、CookpadではAnacondaを前提に環境構築を勧めていました。 今は、ymotongpooに「郷に入っては郷に従え」と言われたため、pip+virtualenv/venvで全てをこなしていますが、これで困ったことは特にありません。macOS, Windows, Linuxそ
GitHubの Trending を眺めていたりすると時たま気になるpython製のツールやライブラリがあって試したくなったりします。 でもよく知らないし試したらすぐ消すようなものを普段の環境に入れるのも抵抗があって、その都度仮想環境を作ったりしていました。 try はそんな時に手軽に仮想環境を作って使い終わったらさくっと廃棄してくれる便利ツールです。 インストール tryで作る環境は2.7などでもいいようですが、try自体はPython3.4以上の対応のようです。 python3 -m pip install trypackage これ(またはpip3など)でインストールでき、コマンドラインからtryコマンドが使えるようになります。 使い方 try [試したいライブラリ名] [[ライブラリ2] [ライブラリ3] ...] これで新しい仮想環境が作られてライブラリがインストール&impor
The latest news from Google on open source releases, major projects, events, and student outreach programs. Google runs millions of lines of Python code. The front-end server that drives youtube.com and YouTube’s APIs is primarily written in Python, and it serves millions of requests per second! YouTube’s front-end runs on CPython 2.7, so we’ve put a ton of work into improving the runtime and adap
Python 3.6 に取り込まれた dict の新実装などでコアコミッターに興味を持ってもらい、 Core Developer (要するにコミッター) に推薦しようか?という提案をもらいました。 最初はコミッターとか面倒そうだし、コミットメッセージとかNEWSエントリー(通常パッチをコミットするときにコミッターが書く)とかを英語で書くのも英語が得意な人がやったほうがいいだろうし、とりあえず github に移行するまでは様子見しておこうと思ってたのですが、 dict 関係のパッチがいくつもレビュー待ちでなかなかコミットされないのを見て「やっぱりアクティブなコミッターが全然足りてない」と考え直し、志願することに。 で、先月末にコミット権をもらった(というか push できる権限を持った hg アカウントに ssh 鍵を登録してもらった)のですが、新米コミッターは簡単なパッチでも他のコアコミ
(訳注:2016/3/9、いただいたフィードバックを元に記事を修正いたしました。) 注意: この記事で書かれている機能は、大部分がPython 3.4で導入されたものです。ネイティブコルーチンとasync/await構文はPython 3.5でサポートされました。そのため、本記事に記載されているコードを試す場合はPython 3.5の利用をお勧めします。 ジェネレータは値を 生成する 関数です。普通、関数は return で値を返したあと、その下層のスコープは破棄します。関数を再度呼び出す場合、その関数はゼロから起動されることになります。つまり1回限りの実行となります。しかしジェネレータ関数は値を yield で返し、関数の実行を一時停止します。その後、関数を呼び出したスコープにコントロールが移ります。関数を再び呼び出して次の値を(存在すれば)得たい時は、実行を再開することができます。では
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く