Merge
This commit is contained in:
commit
fa09420ca3
30
pep-0008.txt
30
pep-0008.txt
|
@ -28,6 +28,9 @@ This style guide evolves over time as additional conventions are
|
|||
identified and past conventions are rendered obsolete by changes in
|
||||
the language itself.
|
||||
|
||||
Many projects have their own coding style guidelines. In the event of any
|
||||
conflicts, such project-specific guides take precedence for that project.
|
||||
|
||||
|
||||
A Foolish Consistency is the Hobgoblin of Little Minds
|
||||
======================================================
|
||||
|
@ -177,7 +180,7 @@ lines. Some web based tools may not offer dynamic line wrapping at all.
|
|||
|
||||
Some teams strongly prefer a longer line length. For code maintained
|
||||
exclusively or primarily by a team that can reach agreement on this
|
||||
issue, it is okay to increase the line nominal line length from 80 to
|
||||
issue, it is okay to increase the nominal line length from 80 to
|
||||
100 characters (effectively increasing the maximum length to 99
|
||||
characters), provided that comments and docstrings are still wrapped
|
||||
at 72 characters.
|
||||
|
@ -210,8 +213,8 @@ before it. Some examples::
|
|||
def __init__(self, width, height,
|
||||
color='black', emphasis=None, highlight=0):
|
||||
if (width == 0 and height == 0 and
|
||||
color == 'red' and emphasis == 'strong' or
|
||||
highlight > 100):
|
||||
color == 'red' and emphasis == 'strong' or
|
||||
highlight > 100):
|
||||
raise ValueError("sorry, you lose")
|
||||
if width == 0 and height == 0 and (color == 'red' or
|
||||
emphasis is None):
|
||||
|
@ -241,18 +244,19 @@ you may use them to separate pages of related sections of your file.
|
|||
Note, some editors and web-based code viewers may not recognize
|
||||
control-L as a form feed and will show another glyph in its place.
|
||||
|
||||
Encodings (PEP 263)
|
||||
-------------------
|
||||
|
||||
Source File Encoding
|
||||
--------------------
|
||||
|
||||
Code in the core Python distribution should always use UTF-8 (or ASCII
|
||||
in Python 2).
|
||||
|
||||
Files using ASCII (in Python 2) or UTF-8 (in Python 3) should not have a
|
||||
coding cookie.
|
||||
Files using ASCII (in Python 2) or UTF-8 (in Python 3) should not have
|
||||
an encoding declaration.
|
||||
|
||||
In the standard library, non-default encodings should be used only for
|
||||
test purposes or when a comment or docstring needs to mention an author
|
||||
name that that contains non-ASCII characters; otherwise, using ``\x``,
|
||||
name that contains non-ASCII characters; otherwise, using ``\x``,
|
||||
``\u``, ``\U``, or ``\N`` escapes is the preferred way to include
|
||||
non-ASCII data in string literals.
|
||||
|
||||
|
@ -309,7 +313,7 @@ Imports
|
|||
|
||||
However, explicit relative imports are an acceptable alternative to
|
||||
absolute imports, especially when dealing with complex package layouts
|
||||
where using absolute imports would be unecessarily verbose::
|
||||
where using absolute imports would be unnecessarily verbose::
|
||||
|
||||
from . import sibling
|
||||
from .sibling import example
|
||||
|
@ -403,7 +407,7 @@ Other Recommendations
|
|||
|
||||
- If operators with different priorities are used, consider adding
|
||||
whitespace around the operators with the lowest priority(ies). Use
|
||||
your own judgement; however, never use more than one space, and
|
||||
your own judgment; however, never use more than one space, and
|
||||
always have the same amount of whitespace on both sides of a binary
|
||||
operator.
|
||||
|
||||
|
@ -891,8 +895,8 @@ Programming Recommendations
|
|||
operator. However, it is best to implement all six operations so
|
||||
that confusion doesn't arise in other contexts.
|
||||
|
||||
- Always use a def statement instead of assigning a lambda expression
|
||||
to a name.
|
||||
- Always use a def statement instead of an assignment statement that binds
|
||||
a lambda expression directly to a name.
|
||||
|
||||
Yes::
|
||||
|
||||
|
@ -923,7 +927,7 @@ Programming Recommendations
|
|||
Class naming conventions apply here, although you should add the
|
||||
suffix "Error" to your exception classes if the exception is an
|
||||
error. Non-error exceptions that are used for non-local flow control
|
||||
or other forms of signalling need no special suffix.
|
||||
or other forms of signaling need no special suffix.
|
||||
|
||||
- Use exception chaining appropriately. In Python 3, "raise X from Y"
|
||||
should be used to indicate explicit replacement without losing the
|
||||
|
|
29
pep-0432.txt
29
pep-0432.txt
|
@ -3,11 +3,11 @@ Title: Simplifying the CPython startup sequence
|
|||
Version: $Revision$
|
||||
Last-Modified: $Date$
|
||||
Author: Nick Coghlan <ncoghlan@gmail.com>
|
||||
Status: Draft
|
||||
Status: Deferred
|
||||
Type: Standards Track
|
||||
Content-Type: text/x-rst
|
||||
Created: 28-Dec-2012
|
||||
Python-Version: 3.4
|
||||
Python-Version: 3.5
|
||||
Post-History: 28-Dec-2012, 2-Jan-2013
|
||||
|
||||
|
||||
|
@ -25,6 +25,31 @@ resolution for most of these should become clearer as the reference
|
|||
implementation is developed.
|
||||
|
||||
|
||||
PEP Deferral
|
||||
============
|
||||
|
||||
Python 3.4 is nearing its first alpha, and already includes a couple of
|
||||
significant low level changes in PEP 445 (memory allocator customisation)
|
||||
and PEP 442 (safe object finalization). As a result of the latter PEP,
|
||||
the shutdown procedure of CPython has also been changed to be more heavily
|
||||
reliant on the cyclic garbage collector, significantly reducing the
|
||||
number of modules that will experience the "module globals set to None"
|
||||
behaviour that is used to deliberate break cycles and attempt to releases
|
||||
more external resources cleanly.
|
||||
|
||||
Furthermore, I am heavily involved in the current round of updates to the
|
||||
Python packaging ecosystem (as both the lead author of PEP 426 and
|
||||
BDFL-delegate for several other PEPs), leaving little to spare to work on
|
||||
this proposal. The other developers I would trust to lead this effort are
|
||||
also working on other things.
|
||||
|
||||
So, due to those practical resource constraints, the proximity of Python
|
||||
3.4 deadlines, and recognition that making too many significant changes to
|
||||
the low level CPython infrastructure in one release is likely to be unwise,
|
||||
further work on this PEP has been deferred to the Python 3.5 development
|
||||
cycle.
|
||||
|
||||
|
||||
Proposal
|
||||
========
|
||||
|
||||
|
|
Loading…
Reference in New Issue