Подтвердить что ты не робот

Каково происхождение __author__?

Где заключено соглашение об использовании частных переменных метаданных, таких как __author__ внутри модуля?

This В потоке почтовых рассылок Python, похоже, намекают на некоторое обсуждение этого вопроса в 2001 году, но по его звучанию соглашение уже было в дикой природе.

Кроме этого, я могу найти этот PEP в метаданных пакета, который кажется в лучшем случае влиятельным, но касательным.

Я хотел бы попытаться найти явный материал по этому вопросу, чтобы мой инструмент документации мог успешно анализировать эти переменные метаданных.

4b9b3361

Ответ 1

Я предполагаю, что это было в старые времена, когда упаковка метаданных не была обычной. В PEP 8 рекомендуется использовать переменную верхнего уровня __version__ для хранения идентификатора ревизии используемой системы управления версиями. Это относится к 2001-05-01. PEP 396 заменяет это на атрибуты __version__ модуля.

Для __author__ есть сообщение из списка рассылки python dev по этому вопросу. Это относится к 2001-03-01. Автор задает вопрос об использовании __author__: "Что дальше? __cute_signoff__?".

Поскольку в PEP нет упоминания, нам не нужно беспокоиться о __author__. Метаданные упаковки - наш друг, так или иначе.

http://mail.python.org/pipermail/python-dev/2001-March/013328.html

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 history
in the source code -- this is more likely than not to become out of
date.  (E.g. from the CVS log it not clear why my contribution
deserves a mention while Tim 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 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__?