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
Job Security (in Python) (Christopher Neugebauer)
Search
PyCon Canada
August 25, 2013
Education
560
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Job Security (in Python) (Christopher Neugebauer)
PyCon Canada
August 25, 2013
More Decks by PyCon Canada
See All by PyCon Canada
Sad Panda Needs a Hug (Nina Zakharenko)
pyconca
0
490
Shopify Checkout (Chris Saunders)
pyconca
0
260
Saturday Morning BreakfastSerial: Hacking Arduinos in Python (Swift)
pyconca
2
180
Skyfield and 15 Years of Bad APIs (Brandon Rhodes)
pyconca
0
460
Planting Open Source Seeds (Kenneth Reitz)
pyconca
0
180
Why Open Source Works (Alex Gaynor)
pyconca
0
240
How to learn Python in 5 Minutes (Daniel Moniz)
pyconca
0
1.1k
Sunday Morning Keynote (Karen Brennan)
pyconca
0
350
Saturday Morning Keynote (Jacob Kaplan-Moss)
pyconca
2
140
Other Decks in Education
See All in Education
Catecismo 26 #2 - Do Credo; Introdução ao 1º artigo
cm_manaus
0
140
Gitがない時代 インターネットがない時代の 開発話
sapi_kawahara
0
310
Visionary Initiative: Materials-Positive Society — Evolving “Things,” empowering a positive society | Science Tokyo
sciencetokyo
PRO
0
110
アラムコSTEAMチャレンジ 実践報告書
codeforeveryone
0
160
【セーフィー】テクニカルライティング&コミュニケーション実践講座(26新卒エンジニア向け研修資料)
ymzaki_m4
0
250
2026年度春学期 統計学 第1回 イントロダクション ー 統計的なものの見方・考え方について (2026. 4. 9)
akiraasano
PRO
0
190
From Days to Minutes: How We Taught an AI to Onboard 50+ Tenants on our AI Features
mfcabrera
0
190
Course Review - Lecture 13 - Information Visualisation (4019538FNR)
signer
PRO
1
2.7k
Case Studies - Lecture 12 - Information Visualisation (4019538FNR)
signer
PRO
0
160
AIには考えられないことを考えられる人になるために
iqbocchi
1
180
解決策を教えても次期リーダーは育たない ─ 器の発達に伴走するために / Partnering with leaders in their vertical development
matsu0228
1
490
良書紹介08_ 頭のいい子がやっているすごいグラフの読み方
bunnchinn3
0
100
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
300
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
590
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Utilizing Notion as your number one productivity tool
mfonobong
4
340
Amusing Abliteration
ianozsvald
1
220
Joys of Absence: A Defence of Solitary Play
codingconduct
1
410
A better future with KSS
kneath
240
18k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Transcript
Hello Canadia!
Job Security (in Python) Christopher Neugebauer @chrisjrn http://chris.neugebauer.id.au
Hello!
Why do people code Python?
“Readability” -- Raymond Hettinger, PyCon US 2013
“Readability Counts” -- Tim Peters, “The Zen of Python” (import
this)
PEP 0008 “Style Guide for Python Code”
None
Readability Sucks.
1. People can comprehend your code.
2. You can maintain your own code.
3. Your code will be more readily reusable.
THIS IS ALL BAD.
How do I write unmaintainable code?
1) Obvious variable names
1) Obvious (to you) variable names
• Callables: Superheroes • Classes: Musical characters • Strings: Famous
actors • Numbers: Movie characters
MerryPoppins.captain_america(matt_damon, james_bond)
Spiderman.spiderman(spiderman)
2) Metaprogramming
class Collection(Magic): def get_spam(self): return self.spam def set_spam(self, default): self.spam
= default
>>> c = Collection() >>> c.set_spam(“eggs”)
>>> c = Collection() >>> c.set_spam(“eggs”) Traceback (most recent call
last): File "<stdin>", line 1, in <module> File "<stdin>", line 10, in __getattribute__ TypeError: instancemethod expected at least 2 arguments, got 0
Help on Collection in module __main__ object: class Collection(Magic) |
Method resolution order: | Collection | Magic | __builtin__.object | | Methods defined here: | | get_spam(self) | | set_spam(self, default)
TRANSLATE = (("get","_bork_"), ("set","_bork_"), ("canhas" , "get"), ("ihasa" , "set"))
class Magic(object): def __getattribute__(self, attribute): oa = attribute for (key,val) in TRANSLATE: attribute = attribute.replace(key, val) try: return object. __getattribute__(self,attribute) except AttributeError: return type(object. __getattribute__(self, oa))
c.ihasa_spam("foo") -> c.set_spam(“foo”) c.canhas_spam() -> c.get_spam()
3) Monkey patching
“A batteries-included standard library” -- Raymond Hettinger, PyCon US 2013
Roll your own standard library
>>> import math >>> math.cos(0)
>>> import math >>> math.cos(0) 0.0
>>> import magic >>> import math >>> math.cos(0) 0.0
import math math.cos, math.sin = math.sin, math.cos
- End -
This talk was a joke.
Don’t do this.
The end. Christopher Neugebauer @chrisjrn http://chris.neugebauer.id.au