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.9k
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
Let's implement useless Python objects (revised)
hayaosuzuki
0
21
Tomorrow graphlib, Let us use everybody
hayaosuzuki
1
1.4k
Tasting "Python Distilled"
hayaosuzuki
0
360
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
Other Decks in Technology
See All in Technology
PostgreSQL 18のNOT ENFORCEDな制約とDEFERRABLEの関係
yahonda
0
110
AI時代のオンプレ-クラウドキャリアチェンジ考
yuu0w0yuu
0
230
Escape from Excel方眼紙 ~マークダウンで繋ぐ、人とAIの架け橋~ /nikkei-tech-talk44
nikkei_engineer_recruiting
0
200
AIエージェント勉強会第3回 エージェンティックAIの時代がやってきた
ymiya55
0
110
形式手法特論:SMT ソルバで解く認可ポリシの静的解析 #kernelvm / Kernel VM Study Tsukuba No3
ytaka23
1
770
Copilot 宇宙へ 〜生成AIで「専門データの壁」を壊す方法〜
nakasho
0
170
Astro Islandsの 内部実装を 「日本で一番わかりやすく」 ざっくり解説!
knj
1
240
プログラミング不要! テスト自動化における生成AI使いこなし術
magicpod
1
110
FastMCP OAuth Proxy with Cognito
hironobuiga
3
180
SaaSに宿る21g
kanyamaguc
2
150
LLMに何を任せ、何を任せないか
cap120
10
4.7k
DMBOKを使ってレバレジーズのデータマネジメントを評価した
leveragestech
0
240
Featured
See All Featured
The Curse of the Amulet
leimatthew05
1
10k
Are puppies a ranking factor?
jonoalderson
1
3.1k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Designing for Performance
lara
611
70k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
840
How GitHub (no longer) Works
holman
316
150k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Fireside Chat
paigeccino
42
3.8k
Believing is Seeing
oripsolob
1
94
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
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