読み飛ばしてください おはようございます、しなもんです。 Pythonの公式ドキュメントを読んでたら、なんか知らない便利機能がたくさん出てきました。 なんだこれ。 というわけでまとめてみました。 参考になれば幸いです。 f-stringsの拡張機能 f-strings、便利ですよね。大好きです。 そんなあいつには裏技があるみたいです。 デバッグ用の=演算子 Python 3.8以降、f-stringの中で=演算子を使用することで 変数名とその値を同時に表示できるらしい。
![「Pythonのドキュメントでも読むか~」「え、何その裏技」 - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/b614274d5943b5286c16de2e68f9f2628746548e/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Fengineer-festa-ogp-background-074608b13b4bbe67c10ada41e7e2d292.png%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTk3MiZoPTM3OCZ0eHQ9JUUzJTgwJThDUHl0aG9uJUUzJTgxJUFFJUUzJTgzJTg5JUUzJTgyJUFEJUUzJTgzJUE1JUUzJTgzJUExJUUzJTgzJUIzJUUzJTgzJTg4JUUzJTgxJUE3JUUzJTgyJTgyJUU4JUFBJUFEJUUzJTgyJTgwJUUzJTgxJThCJUVGJUJEJTlFJUUzJTgwJThEJUUzJTgwJThDJUUzJTgxJTg4JUUzJTgwJTgxJUU0JUJEJTk1JUUzJTgxJTlEJUUzJTgxJUFFJUU4JUEzJThGJUU2JThBJTgwJUUzJTgwJThEJnR4dC1hbGlnbj1sZWZ0JTJDdG9wJnR4dC1jb2xvcj0lMjNGRkZGRkYmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9NTYmcz0xZjQzNDY3ODNmOTIwZTU4NDQ0NDAxNjBmMzRkNDc1Nw%26mark-x%3D120%26mark-y%3D96%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZoPTc2Jnc9OTcyJnR4dD0lNDBDaW5uYW1vblNlYTIwNzMmdHh0LWNvbG9yPSUyM0ZGRkZGRiZ0eHQtZm9udD1IaXJhZ2lubyUyMFNhbnMlMjBXNiZ0eHQtc2l6ZT0zNiZ0eHQtYWxpZ249bGVmdCUyQ3RvcCZzPWNlMDFmMGI5ZTBkMmEwZDBjNzIyOTVlYTMyZTc0ZmMy%26blend-x%3D120%26blend-y%3D445%26blend-mode%3Dnormal%26txt64%3DaW4gVGVhbSBzaGFodQ%26txt-width%3D972%26txt-clip%3Dend%252Cellipsis%26txt-color%3D%2523FFFFFF%26txt-font%3DHiragino%2520Sans%2520W6%26txt-size%3D36%26txt-x%3D134%26txt-y%3D546%26s%3Dd624d38069571cc4544f495399f516dc)
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
メモリリークに悩まされている技術者は多いだろう。メモリリークが嫌で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ページを開く