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
22k
Other Decks in Science
See All in Science
機械学習を支える連続最適化
nearme_tech
PRO
1
240
Cross-Media Information Spaces and Architectures (CISA)
signer
PRO
3
30k
05_山中真也_室蘭工業大学大学院工学研究科教授_だてプロの挑戦.pdf
sip3ristex
0
130
理論計算機科学における 数学の応用: 擬似ランダムネス
nobushimi
1
400
大規模言語モデルの開発
chokkan
PRO
85
43k
論文紹介: PEFA: Parameter-Free Adapters for Large-scale Embedding-based Retrieval Models (WSDM 2024)
ynakano
0
210
The thin line between reconstruction, classification, and hallucination in brain decoding
ykamit
1
1.2k
はじめての「相関と因果とエビデンス」入門:“動機づけられた推論” に抗うために
takehikoihayashi
17
7.3k
The Incredible Machine: Developer Productivity and the Impact of AI
tomzimmermann
0
530
Planted Clique Conjectures are Equivalent
nobushimi
0
110
応用心理学Ⅰテキストマイニング講義資料講義編(2024年度)
satocos135
0
100
位相的データ解析とその応用例
brainpadpr
1
950
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
Code Review Best Practice
trishagee
67
18k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Designing Experiences People Love
moore
140
23k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
A better future with KSS
kneath
238
17k
Code Reviewing Like a Champion
maltzj
521
39k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
440
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
21
2.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
100
18k
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
ʹΈࠐΉ • ϓογϡ͢ΔͱࣗಈͰνΣοΫ͞ΕΔͱ͔
·ͱΊ • ੩తίʔυղੳπʔϧΛຯํʹ͚ͭΑ͏ • ਓݖ৵͕ى͖ͦ͏ͳͱ͖ޙΖʹ '_' ͚ͭΔ • ৭ʑͳ੩తղੳπʔϧ͕͋Δ •
ҙࣝ͠ͳͯ͘πʔϧ͕ΔΈ͕ॏཁ
͋Γ͕ͱ͏͍͟͝·ͨ͠