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.9k
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
22k
Other Decks in Science
See All in Science
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
130
MCMCのR-hatは分散分析である
moricup
0
360
mathematics of indirect reciprocity
yohm
1
140
[第62回 CV勉強会@関東] Long-CLIP: Unlocking the Long-Text Capability of CLIP / kantoCV 62th ECCV 2024
lychee1223
1
940
深層学習を用いた根菜類の個数カウントによる収量推定法の開発
kentaitakura
0
160
CV_5_3dVision
hachama
0
140
06_浅井雄一郎_株式会社浅井農園代表取締役社長_紹介資料.pdf
sip3ristex
0
500
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
210
Transport information Geometry: Current and Future II
lwc2017
0
150
トラブルがあったコンペに学ぶデータ分析
tereka114
2
1.6k
データベース06: SQL (3/3) 副問い合わせ
trycycle
PRO
1
540
統計学入門講座 第4回スライド
techmathproject
0
140
Featured
See All Featured
Balancing Empowerment & Direction
lara
1
370
The Straight Up "How To Draw Better" Workshop
denniskardys
234
140k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
The Cost Of JavaScript in 2023
addyosmani
51
8.5k
A better future with KSS
kneath
239
17k
For a Future-Friendly Web
brad_frost
179
9.8k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Why Our Code Smells
bkeepers
PRO
337
57k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
5
210
Designing for Performance
lara
609
69k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
17
940
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
ʹΈࠐΉ • ϓογϡ͢ΔͱࣗಈͰνΣοΫ͞ΕΔͱ͔
·ͱΊ • ੩తίʔυղੳπʔϧΛຯํʹ͚ͭΑ͏ • ਓݖ৵͕ى͖ͦ͏ͳͱ͖ޙΖʹ '_' ͚ͭΔ • ৭ʑͳ੩తղੳπʔϧ͕͋Δ •
ҙࣝ͠ͳͯ͘πʔϧ͕ΔΈ͕ॏཁ
͋Γ͕ͱ͏͍͟͝·ͨ͠