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
Python Decorators
Search
Eloy Zuniga Jr.
June 19, 2012
Technology
650
8
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Python Decorators
A basic understanding of Python Decorators.
Eloy Zuniga Jr.
June 19, 2012
More Decks by Eloy Zuniga Jr.
See All by Eloy Zuniga Jr.
The Filter Function
eloy
0
92
The `max` function
eloy
0
69
The Command Line Interface
eloy
2
520
Other Decks in Technology
See All in Technology
いちAWSエンジニアのAI活用を振り返る #devio2026 / devio osaka 2026 kawahara
masahirokawahara
2
310
FinTech 1-2 : Overview of FinTech
ks91
PRO
0
130
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
2
1.2k
AI感のないAWS構成図をAIエージェントに描かせたい!
sagochiko
2
500
IR Today: Theory, Practice, and Agents
dtunkelang
0
320
人にやさしく、AIにやさしく、書き手を選ばないIaCのガードレール再考 / Rethinking IaC Guardrails for Humans and AI Alike
kohbis
5
2k
Codex概要
ymiya55
0
220
【データ横丁主催】AI Agentがコンテキストを使って仕事をした後、何が残るのか― 組織の経験を次の判断に引き継ぐ「Agent Memory」
shisyu_gaku
2
320
VS Code × GitHub Copilot での Fabric 開発
ryomaru0825
1
220
Apache Iceberg が拓く AI 時代のオープンレイクハウス
tomtanaka
0
210
行動するAIのためのオントロジー | DevRev — Encraft #26.pdf
dvrv_tknrszk
2
670
企業の現実世界をグラフで写し取る
sansantech
PRO
0
240
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
550
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
The Curse of the Amulet
leimatthew05
3
15k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
Designing for Performance
lara
611
70k
Amusing Abliteration
ianozsvald
1
320
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
520
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
260
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
Decorators What are they? How to explain them. Tuesday, June
19, 12
Tuesday, June 19, 12
Basic definition Decorator is a function that takes a function
as a parameter and returns a function Tuesday, June 19, 12
Basic definition Decorator is a function that takes a function
as a parameter and returns a function Is a function. Takes a function. Returns a function Tuesday, June 19, 12
func = func_hugger(func) Illustration Tuesday, June 19, 12
def in_bed(func): def f(): return ‘%s In bed.’ % func()
return f Change output Tuesday, June 19, 12
def in_bed(func): def f(): if f.in_pool: return ‘%s In pool.’
% func() return ‘%s In bed.’ % func() f.in_pool = False return f Add attributes Tuesday, June 19, 12
def in_bed(func): def f(*args, **kwargs): if args or kwargs: raise
Exception(‘wat?’) return ‘%s In bed.’ % func() return f Validate Tuesday, June 19, 12
Tuesday, June 19, 12
Basic definition Is a function. Takes a function. Returns a
function Tuesday, June 19, 12
Syntactic Sugar Annotation Syntax Tuesday, June 19, 12
Syntactic Sugar Annotation Syntax @func Tuesday, June 19, 12
def luke_quote(): return “I’m Luke SkyWalker, I’m here to rescue
you.” Decorate Tuesday, June 19, 12
def luke_quote(): return “I’m Luke SkyWalker, I’m here to rescue
you.” Decorate @in_bed Tuesday, June 19, 12
def luke_quote(): return “I’m Luke SkyWalker, I’m here to rescue
you.” Decorate @in_bed @no_inbreeding Tuesday, June 19, 12
def luke_quote(): return “I’m Luke SkyWalker, I’m here to rescue
you.” Decorate @in_bed(with=”lightsaber”) @in_bed Tuesday, June 19, 12
Tuesday, June 19, 12
@eloy Tuesday, June 19, 12