Skip to content

Commit 73d89b3

Browse files
committed
Merge remote-tracking branch 'python-guide/master'
2 parents a3ab040 + 50e6613 commit 73d89b3

File tree

12 files changed

+161
-80
lines changed

12 files changed

+161
-80
lines changed

Readme.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ Topics include:
2323
- How to interface w/ hg from git easily
2424
- what libraries to use for what
2525

26-
26+
If you are not fond of reading reStructuredText, there is a
27+
almost up-to-date `HTML version at docs.python-guide.org
28+
<http://docs.python-guide.org>`_.

docs/_themes/kr/static/flasky.css_t

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -528,41 +528,6 @@ a:hover tt {
528528
}
529529
}
530530

531-
532-
/* scrollbars */
533-
534-
::-webkit-scrollbar {
535-
width: 6px;
536-
height: 6px;
537-
}
538-
539-
::-webkit-scrollbar-button:start:decrement,
540-
::-webkit-scrollbar-button:end:increment {
541-
display: block;
542-
height: 10px;
543-
}
544-
545-
::-webkit-scrollbar-button:vertical:increment {
546-
background-color: #fff;
547-
}
548-
549-
::-webkit-scrollbar-track-piece {
550-
background-color: #eee;
551-
-webkit-border-radius: 3px;
552-
}
553-
554-
::-webkit-scrollbar-thumb:vertical {
555-
height: 50px;
556-
background-color: #ccc;
557-
-webkit-border-radius: 3px;
558-
}
559-
560-
::-webkit-scrollbar-thumb:horizontal {
561-
width: 50px;
562-
background-color: #ccc;
563-
-webkit-border-radius: 3px;
564-
}
565-
566531
/* misc. */
567532

568533
.revsys-inline {

docs/dev/env.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ most out of using Python interactively. Its main components are:
252252

253253
* Powerful Python shells (terminal- and Qt-based).
254254
* A web-based notebook with the same core features but support for rich media,
255-
text, code, mathematical expressions and inline plots.
255+
text, code, mathematical expressions and inline plots.
256256
* Support for interactive data visualization and use of GUI toolkits.
257257
* Flexible, embeddable interpreters to load into your own projects.
258258
* Tools for high level and interactive parallel computing.

docs/intro/duction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ include:
1818

1919
Python is sometimes described with the words "batteries included"
2020
for its extensive
21-
`stanadard library <http://docs.python.org/library/>`_, which can
21+
`standard library <http://docs.python.org/library/>`_, which can
2222
includes modules for regular expressions, file IO, fraction handling,
2323
object serialization, and much more.
2424

docs/scenarios/admin.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Systems Administration
44
Fabric
55
------
66

7-
Fabric is a library for simplifying system administration tasks. While Chef
7+
`Fabric <http://docs.fabfile.org>`_ is a library for simplifying system administration tasks. While Chef
88
and Puppet tend to focus on managing servers and system libraries,
99
fabric is more focused on application level tasks such as deployment.
1010

@@ -66,16 +66,23 @@ and we can deploy with:
6666
Additional features include parallel execution, interaction with remote
6767
programs, and host grouping.
6868

69+
`Fabric Documentation <http://docs.fabfile.org>`_
70+
6971
Chef
7072
----
7173

7274
.. todo:: Write about Chef
7375

76+
`Chef Documentation
77+
<http://wiki.opscode.com/display/chef/Documentation>`_
78+
7479
Puppet
7580
------
7681

7782
.. todo:: Write about Puppet
7883

84+
`Puppet Labs Documentation <http://docs.puppetlabs.com>`_
85+
7986
Blueprint
8087
---------
8188

@@ -84,4 +91,7 @@ Blueprint
8491
Buildout
8592
--------
8693

87-
.. todo:: Write about Buildout
94+
.. todo:: Write about Buildout
95+
96+
`Buildout Website <http://www.buildout.org>`_
97+

docs/scenarios/scientific.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ and it performs really well.
1111

1212
Due to its high performance nature, scientific computing in python often refers
1313
to external libraries, typically written in faster languages (like C, or FORTRAN
14-
for matrix operations). The main libraries used are NumPy and SciPy
14+
for matrix operations). The main libraries used are `NumPy`_ and
15+
`SciPy`_.
1516

1617
Libraries
1718
:::::::::
1819

19-
Numpy
20+
NumPy
2021
-----
2122
`NumPy <http://numpy.scipy.org/>`_ is a low level library written in C (and
2223
FORTRAN) for high level mathematical functions. NumPy cleverly overcomes the

docs/starting/install/osx.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ simply run
3333

3434
.. code-block:: console
3535
36-
$ ruby -e "$(curl -fsS https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
36+
$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
3737
3838
Then, insert the Homebrew directory at the top of your ``PATH`` enviornment
3939
variable. You can do this by adding the following line at the bottom of your

docs/writing/documentation.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,12 @@ Sphinx_ is a tool which converts documentation in the :ref:`restructuredtext-ref
206206
markup language into a range of output formats including HTML, LaTeX (for
207207
printable PDF versions), manual pages and plain text.
208208

209-
.. note:: This Guide is built with Sphinx_
209+
There is also a great free hosting for your Sphinx_ docs: `Read The Docs`_
210+
211+
.. note:: This Guide is built with Sphinx_ and hosted on `Read The Docs`_
210212

211213
.. _Sphinx: http://sphinx.pocoo.org
214+
.. _Read The Docs: http://readthedocs.org
212215

213216
.. _restructuredtext-ref:
214217

docs/writing/license.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,26 @@ Open source.
66
There are plenty of `open source licenses <http://opensource.org/licenses/alphabetical>`_
77
available to choose from.
88

9+
In general, these licenses tend to fall into one of two categories:
10+
11+
1. licenses that focus more on the user's freedom to do with the
12+
software as they please (these are the more-permissive open
13+
source licenses such as the MIT, BSD, & Apache), and
14+
15+
2. licenses that focus more on making sure that the code itself —
16+
including any changes made to it and distributed along with it —
17+
always remains free (these are the less-permissive free software
18+
licenses, for example, the GPL and LGPL).
19+
20+
The latter are less-permissive in the sense that they don't permit
21+
someone to add code to the software and distribute it without also
22+
including the source code for their changes.
23+
924
To help you choose one for your project, there's a `license chooser <http://three.org/openart/license_chooser/>`_,
1025
use it.
1126

1227

13-
Non-Restrictive
28+
More-Permissive
1429
:::::::::::::::
1530

1631
PSFL
@@ -34,8 +49,8 @@ Apache
3449
------
3550

3651

37-
Restrictive
38-
:::::::::::
52+
Less-Permissive
53+
:::::::::::::::
3954

4055

4156
LGPL

docs/writing/structure.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Structure is Key
99
----------------
1010

1111
Thanks to the way imports and modules are handled in Python, it is
12-
relatively easy to structure a python project. Easy, here, means
12+
relatively easy to structure a Python project. Easy, here, means
1313
that you do not have many constraints and that the module
1414
importing model is easy to grasp. Therefore, you are left with the
1515
pure architectural task of crafting the different parts of your
@@ -19,7 +19,7 @@ Easy structuring of a project means it is also easy
1919
to do it poorly. Some signs of a poorly structured project
2020
include:
2121

22-
- Multiple and messy circular dependencies: If your classes
22+
- Multiple and messy circular dependencies: if your classes
2323
Table and Chair in furn.py need to import Carpenter from workers.py
2424
to answer a question such as table.isdoneby(),
2525
and if conversely the class Carpenter needs to import Table and Chair,
@@ -28,13 +28,13 @@ include:
2828
fragile hacks such has using import statements inside
2929
methods or functions.
3030

31-
- Hidden coupling: Each and every change in Table's implementation
31+
- Hidden coupling: each and every change in Table's implementation
3232
breaks 20 tests in unrelated test cases because it breaks Carpenter's code,
3333
which requires very careful surgery to adapt the change. This means
3434
you have too many assumptions about Table in Carpenter's code or the
3535
reverse.
3636

37-
- Heavy usage of global state or context: Instead of explicitly
37+
- Heavy usage of global state or context: instead of explicitly
3838
passing ``(height, width, type, wood)`` to each other, Table
3939
and Carpenter rely on global variables that can be modified
4040
and are modified on the fly by different agents. You need to
@@ -43,14 +43,14 @@ include:
4343
template code is also modifying this context, messing with
4444
table dimensions.
4545

46-
- Spaghetti code: Multiple pages of nested if clauses and for loops
46+
- Spaghetti code: multiple pages of nested if clauses and for loops
4747
with a lot of copy-pasted procedural code and no
48-
proper segmentation are known as spaghetti code. Python's
48+
proper segmentation are known as spaghetti code. Python's
4949
meaningful indentation (one of its most controversial features) make
5050
it very hard to maintain this kind of code. So the good news is that
5151
you might not see too much of it.
5252

53-
- Ravioli code is more likely in Python: It consists of hundreds of
53+
- Ravioli code is more likely in Python: it consists of hundreds of
5454
similar little pieces of logic, often classes or objects, without
5555
proper structure. If you never can remember if you have to use
5656
FurnitureTable, AssetTable or Table, or even TableNew for your
@@ -186,14 +186,14 @@ objects, they have a type, they can be passed as function arguments, they may
186186
have methods and properties. In this understanding, Python is an
187187
object-oriented language.
188188

189-
However, unlike Java, Python do not impose object-oriented programming as the
189+
However, unlike Java, Python does not impose object-oriented programming as the
190190
main programming paradigm. It is perfectly viable for a Python project to not
191191
be object-oriented, i.e. to use no or very few class definitions, class
192192
inheritance, or any other mechanisms that are specific to object-oriented
193193
programming.
194194

195195
Moreover, as seen in the modules_ section, the way Python handles modules and
196-
namespaces gives the developer a natural way to ensure
196+
namespaces gives the developer a natural way to ensure the
197197
encapsulation and separation of abstraction layers, both being the most common
198198
reasons to use object-orientation. Therefore, Python programmers have more
199199
latitude to not use object-orientation, when it is not required by the business
@@ -208,8 +208,8 @@ In some architectures, typically web applications, multiple instances of Python
208208
processes are spawned to respond to external requests that can
209209
happen at the same time. In this case, holding some state into instantiated
210210
objects, which means keeping some static information about the world, is prone
211-
to concurrency problems or race-conditions. Sometime between the initialization of the
212-
state of an object, usually done with the __init__() method, and the actual use
211+
to concurrency problems or race-conditions. Sometimes, between the initialization of
212+
the state of an object (usually done with the __init__() method) and the actual use
213213
of the object state through one of its methods, the world may have changed, and
214214
the retained state may be outdated. For example, a request may load an item in
215215
memory and mark it as read by a user. If another request requires the deletion
@@ -230,7 +230,7 @@ in the persistence layer, it is said to have a side-effect.
230230
Carefully isolating functions with context and side-effects from functions with
231231
logic (called pure functions) allow the following benefits:
232232

233-
- Pure functions are more likely to be deterministic: given a fixed input,
233+
- Pure functions are deterministic: given a fixed input,
234234
the output will always be the same.
235235

236236
- Pure functions are much easier to change or replace if they need to
@@ -257,7 +257,7 @@ The Python language provides a simple yet powerful syntax called 'decorators'.
257257
A decorator is a function or a class that wraps (or decorate) a function
258258
or a method. The 'decorated' function or method will replace the original
259259
'undecorated' function or method. Because functions are first-class objects
260-
in Python it can be done 'manually' but using the @decorator syntax is
260+
in Python, it can be done 'manually', but using the @decorator syntax is
261261
clearer and thus preferred.
262262

263263
.. code-block:: python

0 commit comments

Comments
 (0)