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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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.3k
Tasting "Python Distilled"
hayaosuzuki
0
350
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.2k
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
OSSで構築するIT基盤管理実践事例: NetBox・Snipe-IT・FreeRADIUS+PrivacyIDEA / Practical Case Studies of IT Infrastructure Management Using OSS
nttcom
0
190
LLM活用の壁を超える:リクルートR&Dの戦略と打ち手
recruitengineers
PRO
1
220
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
71k
DX Improvement at Scale
ntk1000
2
230
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
44k
入門DBSC
ynojima
0
130
製造業ドメインにおける LLMプロダクト構築: 複雑な文脈へのアプローチ
caddi_eng
0
190
「ヒットする」+「近い」を同時にかなえるスマートサジェストの作り方.pdf
nakasho
0
100
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
14k
男(監査)はつらいよ - Policy as CodeからAIエージェントへ
ken5scal
5
720
Databricksアシスタントが自分で考えて動く時代に! エージェントモード体験もくもく会
taka_aki
0
310
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
30 Presentation Tips
portentint
PRO
1
250
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
140
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
KATA
mclloyd
PRO
35
15k
Balancing Empowerment & Direction
lara
5
930
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
300
Optimising Largest Contentful Paint
csswizardry
37
3.6k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
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