Re: [Python-Dev] some minor questions about pep8

2015年3月21日 14:01:52 -0700

> On Mar 21, 2015, at 4:53 PM, Barry Warsaw <[email protected]> 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
> [email protected]
> 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

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to