在python程序中数据的来源可以是-python – __author__的起源是什么?

我的猜测是,从旧的时候,包装元数据不常见。

在PEP 8中,鼓励使用__version__顶级变量来保存正在使用的版本控制系统的修订版本号。这可追溯到2001-05-01。 PEP 396取代了模块__version__属性。

对于__author__,有一篇关于python开发者邮件列表的帖子。这可追溯到2001-03-01。作者质疑使用__author__:"下一步是__cute_signoff__?”。

既然在PEP中没有提到,我们不用担心__作者___。包装元数据是我们的朋友。

Ping just checked in this:

> Log Message:

> Add __author__ and __credits__ variables.

>

>

> Index: tokenize.py

> ===================================================================

> RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v

> retrieving revision 1.19

> retrieving revision 1.20

> diff -C2 -r1.19 -r1.20

> *** tokenize.py 2001/03/01 04:27:19 1.19

> --- tokenize.py 2001/03/01 13:56:40 1.20

> ***************

> *** 10,14 ****

> it produces COMMENT tokens for comments and gives type OP for all operators."""

>

> ! __version__ = "Ka-Ping Yee, 26 October 1997; patched, GvR 3/30/98"

>

> import string, re

> --- 10,15 ----

> it produces COMMENT tokens for comments and gives type OP for all operators."""

>

> ! __author__ = 'Ka-Ping Yee '

> ! __credits__ = 'first version, 26 October 1997; patched, GvR 3/30/98'

>

> import string, re

I'm slightly uncomfortable with the __credits__ variable inserted

here. First of all, __credits__ doesn't really describe the

information given. Second, doesn't this info belong in the CVS

history? I'm not for including random extracts of a module's history

in the source code -- this is more likely than not to become out of

date. (E.g. from the CVS log it's not clear why my contribution

deserves a mention while Tim's doesn't -- it looks like Tim probably

spent a lot more time thinking about it than I did.)

Anothor source of discomfort is that there's absolutely no standard

for this kind of meta-data variables. We've got __version__, and I

believe we once agreed on that (in 1994 or so :-). But __author__?

__credits__? What next -- __cute_signoff__?

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值