Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PyCon APAC 2013 LT
Search
Hideo Hattori
September 15, 2013
Programming
0
66
PyCon APAC 2013 LT
PEP 8 and autopep8
Hideo Hattori
September 15, 2013
Tweet
Share
More Decks by Hideo Hattori
See All by Hideo Hattori
gocloc
hhatto
0
510
RustとPython
hhatto
4
2.4k
PHP Kansai 2013 LT
hhatto
0
82
Other Decks in Programming
See All in Programming
クリーンアーキテクチャから見る依存の向きの大切さ
shimabox
5
1.1k
CloudNativePGを布教したい
nnaka2992
0
120
コミュニティ駆動 AWS CDK ライブラリ「Open Constructs Library」 / community-cdk-library
gotok365
2
250
もう僕は OpenAPI を書きたくない
sgash708
6
1.9k
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
270
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
41
16k
Introduction to kotlinx.rpc
arawn
0
770
Datadog Workflow Automation で圧倒的価値提供
showwin
1
280
良いコードレビューとは
danimal141
7
1.6k
ファインディLT_ポケモン対戦の定量的分析
fufufukakaka
0
940
Honoのおもしろいミドルウェアをみてみよう
yusukebe
1
240
Better Code Design in PHP
afilina
0
180
Featured
See All Featured
Site-Speed That Sticks
csswizardry
4
410
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
10
520
Statistics for Hackers
jakevdp
797
220k
For a Future-Friendly Web
brad_frost
176
9.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
650
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
114
51k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
BBQ
matthewcrist
87
9.5k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
Transcript
PEP 8 and autopep8 PyCon APAC 2013 LT / 2013.09.15
Hideo Hattori
whoami C/Python/Zsh My Python Projects , , , ... code
on , @hhatto pgmagick otamapy genzshcomp meow Github Bitbucket
PEP 8 coding conventions for the Python code Nc”úùk1 Õúß
Õc v ”c v göpvz̈v©–− 2013.08.01 •ò&\©¤ http://www.python.org/dev/peps/pep- 0008/
PEP 8 modernisation 1 m¤ß”5ðcv •9¡−l¡ ׳•9¡−l¡ Python1.5.2 •9¡−l¡w£Œ\©–¤ß Python2/3
•9¡−l¡wûl\©¤ß http://hg.python.org/peps/rev/fb24c80e9afb
About autopep8 simple command-line tool automatic formatting for Python Code
require v0.9.4 (2013.09.08) pep8 $ pip install autopep8
For Example invalid PEP 8 code import sys, os n
= True if n != None: print("none") def f(x): return 2 * x
Output Auto-Formatting Code $ autopep8 invalid.py import sys import os
n = True if n != None: print("none") def f(x): return 2 * x
Aggressive $ autopep8 -a invalid.py import sys import os n
= True if n is not None: print("none") def f(x): return 2 * x
Print Diff $ autopep8 -d invalid.py --- original/invalid.py +++ fixed/invalid.py
@@ -1,7 +1,10 @@ -import sys, os +import sys +import os n = True if n != None: print("none") -def f(x): return 2 * x + +def f(x): + return 2 * x
Other Feature ignore/select errors max-line recursive/jobs
ofiØ#”O •PEP 8 ³
⁄¿autopep8 ³³›–Æ–z“\o
https://github.com/hhatto/autopep8
Thank you