Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Job Security (in Python) (Christopher Neugebauer)
Search
PyCon Canada
August 25, 2013
Education
570
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
520
Shopify Checkout (Chris Saunders)
pyconca
0
270
Saturday Morning BreakfastSerial: Hacking Arduinos in Python (Swift)
pyconca
2
190
Skyfield and 15 Years of Bad APIs (Brandon Rhodes)
pyconca
0
480
Planting Open Source Seeds (Kenneth Reitz)
pyconca
0
190
Why Open Source Works (Alex Gaynor)
pyconca
0
270
How to learn Python in 5 Minutes (Daniel Moniz)
pyconca
0
1.1k
Sunday Morning Keynote (Karen Brennan)
pyconca
0
370
Saturday Morning Keynote (Jacob Kaplan-Moss)
pyconca
2
150
Other Decks in Education
See All in Education
Book-keeping
bvr7352
0
140
Dronegeografía innovación didáctica y fotogrametría 3D para la enseñanza de la geografía local y la ciudadaniía activa
juanmartin2026
0
54k
Digijulkaisut
matleenalaakso
1
10k
Science Tokyo University for International Research Excellence scheme_April 2026
sciencetokyo
PRO
0
610
Sekolah Sabat - Triwulan 4 2026 - Pelajaran 2
hiola
0
10k
【ainiチャット操作ガイド】
ainischool
0
150
20260908_ターゲットとスコープを決める発表法
masakiokuda
1
140
Carbohydrates: Classification, Structure & Chemical Properties
pawan_pharm
0
340
AWS Academy プログラムのご紹介
hiragahh
0
120
Database Handling in Python: SQLite3, MySQL and CRUD Operations
madhuri28
0
130
Requirements Analysis and Prototyping - Lecture 3 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.8k
Antigravityを使ってGeminiAPI(NanobananaPro)と連携して挿絵メーカーを作った
yoshimura_datam
0
270
Featured
See All Featured
How to Ace a Technical Interview
jacobian
280
24k
Music & Morning Musume
bryan
48
7.4k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
KATA
mclloyd
PRO
35
16k
Side Projects
sachag
456
43k
RailsConf 2023
tenderlove
30
1.6k
Skip the Path - Find Your Career Trail
mkilby
1
260
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
640
Done Done
chrislema
187
17k
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