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
Re: Respect the Built-in Names
Search
momijiame
September 09, 2017
Science
0
1.8k
Re: Respect the Built-in Names
PyCon JP 2017 Day2 LT
momijiame
September 09, 2017
Tweet
Share
More Decks by momijiame
See All by momijiame
SphinxCon JP 2015 - Sphinxで電子書籍を書こうと色々やってみた
momijiame
2
21k
Other Decks in Science
See All in Science
Pericarditis Comic
camkdraws
0
1.1k
Science of Scienceおよび科学計量学に関する研究論文の俯瞰可視化_LT版
hayataka88
0
930
証明支援系LEANに入門しよう
unaoya
0
350
The thin line between reconstruction, classification, and hallucination in brain decoding
ykamit
1
950
深層学習を利用して 大豆の外部欠陥を判別した研究事例の紹介
kentaitakura
0
230
Презентация программы магистратуры СПбГУ "Искусственный интеллект и наука о данных"
dscs
0
390
解説!データ基盤の進化を後押しする手順とタイミング
shomaekawa
1
340
Direct Preference Optimization
zchenry
0
280
Machine Learning for Materials (Lecture 7)
aronwalsh
0
810
大規模言語モデルの開発
chokkan
PRO
84
33k
All-in-One Bioinformatics Platform Realized with Snowflake ~ From In Silico Drug Discovery, Disease Variant Analysis, to Single-Cell RNA-seq
ktatsuya
0
230
Science of Scienceおよび科学計量学に関する研究論文の俯瞰可視化_ポスター版
hayataka88
0
130
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
A Modern Web Designer's Workflow
chriscoyier
693
190k
Teambox: Starting and Learning
jrom
133
8.8k
The Language of Interfaces
destraynor
154
24k
Transcript
Re: Respect the Built-in Names ~ ੩తίʔυղੳπʔϧͷ׆༻ ~ PyCon JP
2017 Day2 LT (2017/9/9) @momijiame
͓લɺ୭Α • Twitter: @momijiame • Blog: http://blog.amedama.jp/ • Book: εϚʔτPythonϓϩάϥϛϯά
• Proposal: ࣮ફSQLAlchemy (མબ)
͜ͷ LT ͷ͖͔͚ͬ • PyCon JP 2017 Day1 LT •
@CardinalXaro ͞Μ • λΠτϧ: Respect the Built-in Names • ༰: ϏϧτΠϯؔʹਓݖ͋Δʂ
ਓݖ৵ͷྫ def max(elements): … def f(id, name): … str =
'Hello, World!'
͋Δ͋Δ…
ͦΜͳʹ͋Δ͋ΔͳΒ ࣗಈͰνΣοΫ͍ͨ͠
ຊͷϝΠϯςʔϚ
੩తίʔυղੳπʔϧͷ׆༻
੩తίʔυղੳπʔϧͱʁ • ιʔείʔυΛ੩తʹղੳ͢Δπʔϧͷ͜ͱ • ੩త: ιʔείʔυΛ࣮ࡍʹಈ͔͞ͳ͍ • యܕతʹ AST (நߏ)
Λղੳ͢Δ • ಈత: ιʔείʔυΛ࣮ࡍʹಈ͔ͯ͠ΈΔ
πʔϧΛͬͨͱ͖ͷخ͠͞ • νΣοΫͯ͘͠ΕΔ͜ͱͷྫ • ίʔσΟϯάελΠϧʹԊ͍ͬͯΔ͔ʁ • όάͷݪҼͱͳΔΑ͏ͳهड़ͳ͍͔ʁ • ਓݖ৵͍ͯ͠ͳ͍͔ʁ
Pylint • Ϡό͍ॻ͖ํͯ͠Δͱڭ͑ͯ͘ΕΔ • ͘͢͝ྑ͍πʔϧ͚ͩͲӨ͕ബ͍ (ؾ͕͢Δ) $ pip install pylint
࣮ߦྫ • ઌ΄Ͳͷਓݖ৵શͯ Pylint Ͱर͑Δ $ pylint --disable=R,C overwrite.py No
config file found, using default configuration ************* Module overwrite W: 1, 0: Redefining built-in 'str' (redefined-builtin) …(লུ)
ͱ͜ΖͰɺਓݖ৵Λ ݟ͚ͭͨͱ͖Ͳ͏͢Εʁ
࣮ରॲํ๏͕ PEP8 ʹʂ single_trailing_underscore_: used by convention to avoid conflicts
with Python keyword, e.g. Tkinter.Toplevel(master, class_='ClassName') https://www.python.org/dev/peps/pep-0008/
ࣦΘΕͨਓݖΛऔΓͨ͠ྫ def max_(elements): … def f(id_, name): … str_ =
'Hello, World!'
·ͩ·ͩ͋ΔΑʂ • ศརͳ੩తղੳπʔϧͨͪ • pycodestyle (چ pep8 / ίʔσΟϯάελΠϧνΣοΧ) •
pydocstyle (چ pep257 / ίʔσΟϯάελΠϧνΣοΧ) • Flake8 (ϓϥΨϒϧͳઃܭͷ൚༻੩తίʔυղੳπʔϧ) • Radon (ίʔυͷෳࡶΛఆྔతʹଌఆ) • autopep8, yapf (ίʔυϑΥʔϚολ)
πʔϧΛ͏্ͰͷϙΠϯτ • ॏཁ: ࣗಈͰνΣοΫ͕࣮ߦ͞ΕΔΑ͏ʹ͢Δ • ΤσΟλͱ౷߹͢Δ • อଘ࣌ʹࣗಈͰνΣοΫ͞ΕΔͱ͔ • CI
ʹΈࠐΉ • ϓογϡ͢ΔͱࣗಈͰνΣοΫ͞ΕΔͱ͔
·ͱΊ • ੩తίʔυղੳπʔϧΛຯํʹ͚ͭΑ͏ • ਓݖ৵͕ى͖ͦ͏ͳͱ͖ޙΖʹ '_' ͚ͭΔ • ৭ʑͳ੩తղੳπʔϧ͕͋Δ •
ҙࣝ͠ͳͯ͘πʔϧ͕ΔΈ͕ॏཁ
͋Γ͕ͱ͏͍͟͝·ͨ͠