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.6k
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
Onsager代数とその周辺 / Onsager algebra tsudoi
usamik26
0
380
名古屋市立大学データサイエンス学部 夏のオープンキャンパス模擬授業20230818
ncu_ds
0
930
文系出身でも「アルゴリズム×数学」はスッキリ理解できた!話
wakamatsu_takumu
0
200
スポーツメトリクス設計に対比較法を使いまくる / Sports metrics design using pairwise comparison method (spoana#14)
konakalab
1
690
Design of three-dimensional binary manipulators based on the KS statistic and maximum empty circles (IECON2023)
konakalab
0
220
Machine Learning for Materials (Lecture 2)
aronwalsh
0
570
iRIC v4 solver poster
nkmr_rl
0
1.4k
A Theory of Scrum Team Effectiveness 〜『ゾンビスクラムサバイバルガイド』の裏側にある科学〜
bonotake
12
5k
東大・松尾研主催 LLM Summer 2023 コンペ解法 (11位 – 20位枠での優秀賞)
hayataka88
0
180
Transformer系機械学習モデルを取り巻くライブラリや用語を整理する
bobfromjapan
2
480
統計的因果探索の方法
sshimizu2006
0
860
データで課題を解決する -因果関係を調べる統計的因果推論-
sshimizu2006
4
1.3k
Featured
See All Featured
Embracing the Ebb and Flow
colly
79
4.1k
Docker and Python
trallard
33
2.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Code Reviewing Like a Champion
maltzj
513
39k
Building Better People: How to give real-time feedback that sticks.
wjessup
354
18k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Thoughts on Productivity
jonyablonski
57
3.8k
What the flash - Photography Introduction
edds
64
11k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
1
1.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
18
1.7k
The Pragmatic Product Professional
lauravandoore
24
5.8k
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
ʹΈࠐΉ • ϓογϡ͢ΔͱࣗಈͰνΣοΫ͞ΕΔͱ͔
·ͱΊ • ੩తίʔυղੳπʔϧΛຯํʹ͚ͭΑ͏ • ਓݖ৵͕ى͖ͦ͏ͳͱ͖ޙΖʹ '_' ͚ͭΔ • ৭ʑͳ੩తղੳπʔϧ͕͋Δ •
ҙࣝ͠ͳͯ͘πʔϧ͕ΔΈ͕ॏཁ
͋Γ͕ͱ͏͍͟͝·ͨ͠