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.8k
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
Tomorrow graphlib, Let us use everybody
hayaosuzuki
1
1.1k
Tasting "Python Distilled"
hayaosuzuki
0
340
Let's implement useless Python objects
hayaosuzuki
0
2k
How to Write Robust Python Code
hayaosuzuki
5
4.6k
Unknown Evolution of the Built-in Function pow
hayaosuzuki
0
1.5k
Python for Everyday
hayaosuzuki
1
2.3k
How to Use In-Memory Streams
hayaosuzuki
1
6.1k
Do you know cmath module?
hayaosuzuki
0
3.3k
Elementary Number Theory with Python
hayaosuzuki
1
3.6k
Other Decks in Technology
See All in Technology
Codex 5.3 と Opus 4.6 にコーポレートサイトを作らせてみた / Codex 5.3 vs Opus 4.6
ama_ch
0
190
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.6k
日本の85%が使う公共SaaSは、どう育ったのか
taketakekaho
1
240
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
240
量子クラウドサービスの裏側 〜Deep Dive into OQTOPUS〜
oqtopus
0
140
We Built for Predictability; The Workloads Didn’t Care
stahnma
0
150
広告の効果検証を題材にした因果推論の精度検証について
zozotech
PRO
0
210
今日から始めるAmazon Bedrock AgentCore
har1101
4
420
AWS Network Firewall Proxyを触ってみた
nagisa53
1
240
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.4k
Bedrock PolicyでAmazon Bedrock Guardrails利用を強制してみた
yuu551
0
260
Kiro IDEのドキュメントを全部読んだので地味だけどちょっと嬉しい機能を紹介する
khmoryz
0
210
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
New Earth Scene 8
popppiees
1
1.5k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
130
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
350
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Color Theory Basics | Prateek | Gurzu
gurzu
0
200
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Testing 201, or: Great Expectations
jmmastey
46
8.1k
Code Reviewing Like a Champion
maltzj
527
40k
Paper Plane (Part 1)
katiecoart
PRO
0
4.3k
Ruling the World: When Life Gets Gamed
codingconduct
0
150
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
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