Chinaunix首页 | 论坛 | 博客
  • 博客访问: 303645
  • 博文数量: 23
  • 博客积分: 2589
  • 博客等级: 少校
  • 技术积分: 960
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-30 10:26
文章分类

全部博文(23)

文章存档

2012年(1)

2011年(3)

2009年(13)

2008年(6)

我的朋友

分类: Python/Ruby

2009-04-16 10:55:53

作用类似gcc中的__func__宏

method 1, inspect
import inspect
def foo():
    inspect.getframeinfo( inspect.currentframe() )[2]

method2, sys
import sys
def bar():
    sys._getframe().f_code.co_name

阅读(1013) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~