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
Respect the Built-in Names
Search
HayaoSuzuki
September 08, 2017
Technology
0
4.6k
Respect the Built-in Names
PyCon JP 2017 Day1 Lightning Talk
HayaoSuzuki
September 08, 2017
Tweet
Share
More Decks by HayaoSuzuki
See All by HayaoSuzuki
Tasting "Python Distilled"
hayaosuzuki
0
180
Let's implement useless Python objects
hayaosuzuki
0
1.5k
How to Write Robust Python Code
hayaosuzuki
5
3.7k
Unknown Evolution of the Built-in Function pow
hayaosuzuki
0
1.3k
Python for Everyday
hayaosuzuki
1
1.8k
How to Use In-Memory Streams
hayaosuzuki
1
4k
Do you know cmath module?
hayaosuzuki
0
3.1k
Elementary Number Theory with Python
hayaosuzuki
1
3.4k
Django QuerySet "ARE" Patterns
hayaosuzuki
0
3.2k
Other Decks in Technology
See All in Technology
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
110
Taming you application's environments
salaboy
0
180
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
860
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
830
Can We Measure Developer Productivity?
ewolff
1
150
CysharpのOSS群から見るModern C#の現在地
neuecc
1
3k
スクラムチームを立ち上げる〜チーム開発で得られたもの・得られなかったもの〜
ohnoeight
2
350
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
300
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
いざ、BSC討伐の旅
nikinusu
2
770
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
380
Featured
See All Featured
KATA
mclloyd
29
14k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Why Our Code Smells
bkeepers
PRO
334
57k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
The World Runs on Bad Software
bkeepers
PRO
65
11k
Unsuck your backbone
ammeep
668
57k
Transcript
Respect the Built-in Names Hayao Suzuki PyCon JP 2017 Lightning
Talk at Waseda Univ. September 8, 2017
Who Am I? About Me Name Hayao Suzuki (@CardinalXaro) Blog
http://xaro.hatenablog.jp/ Major Mathematics (Combinatorics, Number Theory) Work Python Programmer at iRidge, Inc. Reviewed Books Effective Python (O’Reilly Japan) ΞϧΰϦζϜΫΠοΫϦϑΝϨϯε ୈ 2 ൛ (O’Reilly Japan) ॳΊͯͷ PHP (O’Reilly Japan) Effective Debugging (O’Reilly Japan) ͢Β͢ΒΘ͔Δ Python ʢᠳӭࣾʣ Python ͱ JavaScript Ͱ͡ΊΔσʔλϏδϡΞϥΠθʔγϣϯ (O’Reilly Japan) 2 / 9
Today’s Theme Respect the Built-in Names 3 / 9
Examples sum is a name of built-in function but... sum
= 0 for i in range(10): sum = sum + i print(sum) sum ͷೖѱ͍จ໌ʂʂ 4 / 9
Examples id is a name of built-in function but... id
= 12345 name = "Ξϧςϥ" print(f"Α͏ͦ͜{name}͞Μ (id={id})") id ͷೖѱ͍จ໌ʂʂ 5 / 9
Examples list is a name of sequence class but... list
= [1, 2, 3, 4, 5] for i in range(len(list)): print(list[i]) list ͷೖѱ͍จ໌ʂʂ 6 / 9
Examples dict is a name of mapping class but... dict
= {"spam": 0, "egg": 1, "bacon":2} for k, v in dict.items(): print("%s: %s" % (k, v)) dict ͷೖѱ͍จ໌ʂʂ 7 / 9
Examples json is a name of built-in module but... import
json import requests response = requests.get("https://examples.com") if response.status_code == 200: json = response.json() print(json.keys()) json ͷೖѱ͍จ໌ʂʂ 8 / 9
Conclusion Respect the built-in names Abuse of names causes a
trouble. If you provide objects with the same name as a built-in value, read builtins module’s documents. 9 / 9