Skip to Content
전문가를 위한 파이썬(2판)
book

전문가를 위한 파이썬(2판)

by 루시아누 하말류, 강권학
November 2024
Beginner to intermediate
1064 pages
25h 21m
Korean
Hanbit Media, Inc.
Content preview from 전문가를 위한 파이썬(2판)
403
9
데커레이터와 클로저
새로 구현한 기능을 시험하는 [예제
9
-
25
]와 [예제
9
-
26
]을 보자. 여기에서는
clockdeco_
param
을 이용해 모듈 두 개를 만들고 이들이 생성한 출력을 보여 준다.
예제
9-25
clockdeco
_
param
_
demo1
.
py
import time from clockdeco_param
import clock
@clock(‘{name}: {elapsed}s’)
def snooze(seconds):
time.sleep(seconds)
for i in range(3):
snooze(.123)
[예제
9
-
25
]를 실행한 결과는 다음과 같다.
$ python3 clockdeco_param_demo1.py
snooze: 0.12414693832397461s
snooze: 0.1241159439086914s
snooze: 0.12412118911743164s
예제
9-26
clockdeco
_
param
_
demo2
.
py
import time from clockdeco_param
import clock
@clock(‘{name}({args}) dt={elapsed:0.3f}s’)
def snooze(seconds):
time.sleep(seconds)
for i in range(3):
snooze(.123)
404
2
객체로서의 함수
[예제
9
-
26
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

전문가를 위한 리액트

전문가를 위한 리액트

테자스 쿠마르
고성능 파이썬(2판)

고성능 파이썬(2판)

오현석, 미샤 고렐릭, 이안 오스발트

Publisher Resources

ISBN: 9791169211772