在早期的Python中重现Python 3.3 __qualname__的效果 [英] Reproduce effects of Python 3.3 __qualname__ in earlier Pythons

查看:73
本文介绍了在早期的Python中重现Python 3.3 __qualname__的效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python 3.3添加了 __ qualname __ 属性可以让人们获得一个函数的合格名称(例如,module.submodule.class.function)或类似名称.

Python 3.3 added the __qualname__ attribute which allows people to get the qualified name of a function (think module.submodule.class.function) or similar.

是否可以在Python 2.6和2.7中重现此属性?

Is there a way to reproduce this attribute in Python 2.6 and 2.7?

推荐答案

我编写了一个库,该库提供了与旧版本Python等效的 __ qualname __ :

I've written a library that provides a __qualname__ equivalent for older Python versions: https://github.com/wbolster/qualname

这篇关于在早期的Python中重现Python 3.3 __qualname__的效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆