python核心编程-函数-装饰器
来源:互联网 发布:js获取整个页面的内容 编辑:程序博客网 时间:2024/05/21 09:23
#!/usr/bin/env python# -*- coding: UTF-8 -*- from time import ctime,sleepdef tsfunc(func): '''装饰器''' def wrappedFunc(): print '[%s] %s() called' % (ctime(),func.__name__) return func() return wrappedFunc@tsfuncdef foo(): passfoo()sleep(4)for i in range(3): sleep(1) foo()
输出
D:\Python27\test>func5.py[Tue Dec 01 22:29:50 2015] foo() called[Tue Dec 01 22:29:55 2015] foo() called[Tue Dec 01 22:29:56 2015] foo() called[Tue Dec 01 22:29:57 2015] foo() calledD:\Python27\test>
0 0
- python核心编程-函数-装饰器
- python 装饰器的函数式编程
- python元编程--装饰器函数
- python函数式编程中的装饰器
- python函数式编程之装饰器
- Python装饰器与函数式编程
- python函数式编程:匿名函数,装饰器,偏函数
- python 装饰器编程
- python 装饰器编程
- python函数式编程(三)装饰器、偏函数
- PYTHON 函数装饰器
- python 函数装饰器
- Python函数:装饰器
- Python 函数装饰器
- python函数装饰器
- python函数装饰器
- python 装饰器函数
- [Python]核心编程之函数
- 三个有意思的php函数
- python核心编程-函数-内嵌函数
- windows溢出保护原理与绕过方法概览
- Lighty的Chunk设计
- 培训机构毕业的程序员被歧视的背后逻辑
- python核心编程-函数-装饰器
- MyBatis学习笔记二
- 自动布局神器 -- ZXPAutoLayout框架的使用
- Linux内核zero-copy小试牛刀(加注释)
- Android应用集成微信支付
- STM32 PCB触摸按键(RC检测法)
- 南大软院二十一天成神计划
- 安卓仿IOS开关设计
- Word Ladder