EngineeringPyflame: Uber Engineering’s Ptracing Profiler for PythonSeptember 27, 2016 / Global At Uber, we make an effort to write efficient backend services to keep our compute costs low. This becomes increasingly important as our business grows; seemingly small inefficiencies are greatly magnified at Uber’s scale. We’ve found flame graphs to be an effective tool for understanding the CPU and mem
はじめに システム作ってるとかライブラリ作ってるみたいなある程度Pythonを綺麗に1書くことが求められる方々に向けた記事です。 (機械学習系のライブラリを使うためにPython書いてる方とか、初学者の方にはちょっとあわないかも知れません) 綺麗に書くための作法の難しさって共有が面倒なところだと思うんですよね。その書き方は間違いじゃない、間違いじゃないけどもっといい書き方があるぞみたいなやつってなかなか指摘し辛いですし、じゃあ1人に対してレビューしたら他のメンバーにはどう伝える?そもそも伝える必要?俺の工数は?みたいになりがちです。 一番いいのはこういう時はこう書く!みたいなドキュメントを作って「ドキュメント違反です」ってレビューをしてあげることなんですが、まーそれもそれで超面倒じゃないですか。なのでこの記事がそのドキュメントの代わり、とまではいかなくとも礎くらいになればいいなと思って書き
yapf インストール 使い方 整形スタイル 整形スタイルの各項目 プラグイン yapf github.com yapfを使用するとPythonコードを整形(フォーマット)できるので試してみる。yapfはYet Another Python Formatterの略のようだ。 インストール pipでインストールできるので下記コマンドを実行。 $ pip install yapf ただし、yapfは頻繁に変更が加えられているということなので今回はGitHubのリポジトリをインストールしてみる。 $ pip install git+https://github.com/google/yapf ヘルプメッセージ $ yapf --version yapf 0.17.0 $ yapf --help usage: yapf [-h] [-v] [-d | -i] [-r | -l START-END]
はじめに 「pycocotools」がWindowsでもpipを使って簡単にインストールできるようになった。 touch-sp.hatenablog.com 今回はpycocotoolsを使ってCOCO datasets を扱ってみる。 COCO datasetsのダウンロード、解凍 まずはGluonCVのチュートリアルページから「val2017.zip」と「annotations_trainval2017.zip」をダウンロード。 「coco_data」というフォルダを作成しそちらの中にダウンロードしたZIPファイルを解凍する。 以下のような構造にする。 coco_data | +---annotations | captions_train2017.json | captions_val2017.json | instances_train2017.json | instances_v
Better datetime DateTime Drop-in replacement for the standard datetime class. Manipulate your datetimes with ease. import pendulum now = pendulum.now("Europe/Paris") # Changing timezone now.in_timezone("America/Toronto") # Default support for common datetime formats now.to_iso8601_string() # Shifting now.add(days=2)
The big alternatives to Python datetime all share similar goals. These goals are ease of use, simplicity and intelligent/user friendly API design. Awesome goals and I love those libraries for investing a lot of effort to achieve them. What I wanted to find out was how much impact using libraries like Arrow, Pendulum or Delorean have on the performance of the code you’re writing. Why bother about t
# -*- coding: utf-8 -*- """Example Google style docstrings. This module demonstrates documentation as specified by the `Google Python Style Guide`_. Docstrings may extend over multiple lines. Sections are created with a section header and a colon followed by a block of indented text. Example: Examples can be given using either the ``Example`` or ``Examples`` sections. Sections support any reStruct
前置き 本記事では、Googleスタイル形式でのPython Docstringの書き方について必要最低限に絞って説明する。 これから、Python Docstringを覚えようとしているエンジニアの参考になれば、幸いである。 Python Docstringとは Pythonにおけるクラスや、メソッド(関数)についての説明を記載したコメント文のこと。 Docstringは、__doc__という変数に格納されている。 以下は、printメソッドのDocstringを表示させたもの。 >>> print(print.__doc__) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Opti
Style guide# This document describes the syntax and best practices for docstrings used with the numpydoc extension for Sphinx. Note For an accompanying example, see example.py. Some features described in this document require a recent version of numpydoc. For example, the Yields section was added in numpydoc 0.6. Overview# We mostly follow the standard Python style conventions as described here: S
日々Pythonの色々な記事がアップされているものの、あまりdocstringに触れている日本語の記事が少ないな・・ということで書きました。 そもそもdocstringって? Pythonの関数だったりクラスだったりに記述するコメントです。 JSDocだったりのPython版です。 書き方は、最初結構他の言語と違うな・・という印象を受けました。 docstring書くと何が嬉しいの? 後で見直したときに、すぐ内容が把握できるよ Guido の重要な洞察のひとつに、コードは書くよりも読まれることの方が多い、というものがあります。 はじめに — pep8-ja 1.0 ドキュメント 最初は少し時間がかかっても、書いておくと後でコードを読み直した時の負担が減ります。 関数などを扱う際に、内容を見たりできるよ jupyter などであれば、nbextentionsでhinterlandを有効化する
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く