[Python-Dev] some minor questions about pep8
Donald Stufft
donald at stufft.io
Sat Mar 21 22:00:11 CET 2015
> On Mar 21, 2015, at 4:53 PM, Barry Warsaw <barry at python.org> wrote:
>
> On Mar 20, 2015, at 08:53 PM, Guido van Rossum wrote:
>
>> FWIW, I think __version__, __author__ etc. were bad ideas. Almost nobody
>> manages these correctly. Note that the PEP 8 section starts with less than
>> an endorsement: "If you *have* to have Subversion, CVS, or RCS crud in your
>> source file, do it as follows."
>
> I tend to agree. Individual module version numbers are mostly useless,
> especially with today's hash-based vcses.
>
> That's different than package versions, and for which I really need to
> resurrect and update PEP 396.
I sort of think (though I haven’t completely convinced myself) that adding
something like __version__ to a package is a work around to the fact that
we don’t have an API that lets someone ask “what is the distribution and
version that this module/import-package came from”.
Something like:
>>> import theorticalapi
>>> import mymodule
>>>
>>> d = theorticalapi.module_dist(mymodule)
>>> print(d.name)
>>> mycustommodules
>>> print(d.version)
>>> 1.0
Since we (theoretically) should have all of this information already inside
of the packaging metadata, we just don’t have a way to say “given a particular
import, give me the information I want).
>
>> That said, if an official answer is required, common sense would suggest
>> that __version__ should go before the imports. (I would put it before the
>> docstring too, except then the docstring wouldn't be a docstring any more.
>> Go figure.)
>
> And after __future__ imports too, right?
>
> Cheers,
> -Barry
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/donald%40stufft.io
---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150321/50269253/attachment.sig>
More information about the Python-Dev
mailing list