Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Readability counts. (The whole Zen is worth reading...) The first step in programming is getting stuff to work at all. The next step in programming is getting stuff to work regularly. The step after that is reusing code and designing for reuse. Somewhere in there you will start writing idiomatic Python.
MotivationAt When I Work we record key actions that users take on the site in order to improve our products. In a typical day, this amounts to 65 million records and 1 TB of data. The volume of data can be challenging to analyze over a range of many days. The size of the data forces our analyses to be performed over a shorter period than we would like. This challenge inspired us to find a way to p
Photo by Chris Ried on Unsplash1. F-StringsF-Strings provide a concise and convenient way to embed Python expressions inside string literals for formatting. First, let’s define two variables name and age that you want to include in our print statement. name = "Pavel" age = 23To not deal with string concatenation or using commas inside the print statement, you can use Python’s improved String forma
Although on the surface Python might appear to be a language of simplicity that anyone can learn, and it is, many might be surprised to know just how much mastery one can obtain in the language. Python is one of those things that is rather easy learn, but can be difficult to master. In Python, there are often multiple ways of doing things, but it can be easy to do the wrong thing, or reinvent the
メモリリークに悩まされている技術者は多いだろう。メモリリークが嫌でGCという技術が開発されたといっても過言ではないし、歴史的にはC++からJavaへシフトが起きた大きな理由のひとつといっていい。Unix系の簡単な定義でいえば、ヒープ領域を指すポインタ(アドレス)をロストしてしまえばそのメモリはもう漏れたといってよい。たとえばこういったコードだ。 struct { int i; char c; } spam; int main(){ void* p; int i; for(i=0; i<1024; ++i){ p = malloc(sizeof(struct spam)); } pause(); } このコードではpause(3)の時点で約5KBのメモリが漏れている。free(3)を使えばメモリをOSに返却できるが、アドレスが分からないので返却できない。 ところが、ここでいいたいのは、メモリ
Features of a programming language, whether syntactic or semantic, are all part of the language's user interface. And a user interface can handle only so much complexity or it becomes unusable. This is also the reason why Python will never have continuations, and even why I'm uninterested in optimizing tail recursion. Thus spoke Guido - as LtU readers already know. Now, not even four weeks later,
ActiveState Code (http://code.activestate.com/recipes/576720/) Python does not have lazy evaluation syntax features built-in, but fortunately decorators can be used with new-style classes to emulate such a feature. There are cases where one wants foo.property to return the actual property whose calculation takes significant amount of time. This recipe adapts the existing property to provide a lazy
2011/12/25まで全25エントリつながりました。 参加していただいたみなさん。ありがとうございました! 今年もAdvent Calendarの季節がやってきました。 12/1から、順番に1日1エントリ書いて行ってクリスマスを迎えましょう! どんな内容を書けばいいの? Python3に関係していればなんでもオーケーです。 これまで二の足を踏んでいた方たちも、これを機会にPython3を触ってみてはどうでしょう。 ネタ例 Python3のここがすごいPython3から2にバックポートされたライブラリPython3で動かしてみたPython2からPython3へのポーティング 流れ まずは、このイベントに参加しましょう。俺はこのネタじゃないと書けない!という人はコメントで主張しておきましょう。指名された翌日にブログのエントリを書きましょう。都合が悪い場合は、代わりの人を探してください。次の
Inspect Shell lets you easily use a shell to inspect a process as it's running
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く