Skip to content

Commit 5cf74be

Browse files
author
Kenneth Reitz
committed
Merge pull request #255 from rgbkrk/master
Mostly grammar fixes
2 parents 7a4ba7b + 810956c commit 5cf74be

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

docs/starting/which-python.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ PyPy aims for maximum compatibility with the reference CPython implementation
6969
while improving performance.
7070

7171
If you are looking to squeeze more performance out of your Python code, it's
72-
worth giving PyPy a try. On a suite of benchmarks, it's current `over 5 times
72+
worth giving PyPy a try. On a suite of benchmarks, it's currently `over 5 times
7373
faster than CPython <http://speed.pypy.org/>`_.
7474

7575
Currently PyPy supports Python 2.7. [#pypy_ver]_
@@ -90,11 +90,11 @@ Currently Jython supports up to Python 2.5. [#jython_ver]_
9090
IronPython
9191
----------
9292

93-
`IronPython <http://ironpython.net/>`_ is an implementation of Python for .NET
93+
`IronPython <http://ironpython.net/>`_ is an implementation of Python for the .NET
9494
framework. It can use both Python and .NET framework libraries, and can also
9595
expose Python code to other .NET languages.
9696

97-
`Python Tools for Visual Studio <http://ironpython.net/tools/>`_ integrate
97+
`Python Tools for Visual Studio <http://ironpython.net/tools/>`_ integrates
9898
IronPython directly in to the Visual Studio development environment, making it
9999
an ideal choice for Windows developers.
100100

docs/writing/structure.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ environment, or your project's internal modules.
9191

9292
To keep in line with the style guide, keep module names short, lowercase, and
9393
be sure to avoid using special symbols like the dot (.) or question mark (?).
94-
So a file name like `my.spam.py` is one you should try to avoid! Naming this way
94+
So a file name like `my.spam.py` is one you should avoid! Naming this way
9595
will interfere with the way python looks for modules.
9696

9797
In this example python expects to find a "spam.py" file in a folder named "my"
@@ -281,7 +281,7 @@ Decorators
281281
----------
282282

283283
The Python language provides a simple yet powerful syntax called 'decorators'.
284-
A decorator is a function or a class that wraps (or decorate) a function
284+
A decorator is a function or a class that wraps (or decorates) a function
285285
or a method. The 'decorated' function or method will replace the original
286286
'undecorated' function or method. Because functions are first-class objects
287287
in Python, it can be done 'manually', but using the @decorator syntax is
@@ -445,7 +445,8 @@ with calls to append().
445445
.. code-block:: python
446446
447447
# create a concatenated string from 0 to 19 (e.g. "012..1819")
448-
print "".join([str(n) for n in range(20)])
448+
nums = [str(n) for n in range(20)]
449+
print "".join(nums)
449450
450451
One final thing to mention about strings is that using join() is not always
451452
best. In the instances where you are creating a new string from a pre-determined

docs/writing/style.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ recognised fact that code is read much more often than it is written.
1010
One reason for Python code to be easily read and understood is its relatively
1111
complete set of Code Style guidelines and "Pythonic" idioms.
1212

13-
Moreover, when a veteran Python developer (a Pythonista) point to some
14-
parts of a code and say it is not "Pythonic", it usually means that these lines
13+
Moreover, when a veteran Python developer (a Pythonista) points to portions of code
14+
and says they are not "Pythonic", it usually means that these lines
1515
of code do not follow the common guidelines and fail to express the intent in
1616
what is considered the best (hear: most readable) way.
1717

@@ -89,7 +89,7 @@ Arguments can be passed to functions in four different ways.
8989
simplest form of arguments and they can be used for the few function arguments
9090
that are fully part of the functions meaning and their order is natural. For
9191
instance, in ``send(message, recipient)`` or ``point(x, y)`` the user of the
92-
function has no difficulty to remember that those two function require two
92+
function has no difficulty remembering that those two functions require two
9393
arguments, and in which order.
9494

9595
In those two cases, it is possible to use argument names when calling the functions
@@ -103,7 +103,7 @@ used for optional parameters sent to the function. When a function has more than
103103
two or three positional parameters, its signature will be more difficult to remember
104104
and using keyword argument with default values is helpful. For instance, a more
105105
complete ``send`` function could be defined as ``send(message, to, cc=None, bcc=None)``.
106-
Here ``cc`` and ``bcc`` are optional, and evaluate to ``None`` when the are not
106+
Here ``cc`` and ``bcc`` are optional, and evaluate to ``None`` when they are not
107107
passed another value.
108108

109109
Calling a function with keyword arguments can be done in multiple ways in Python,
@@ -189,18 +189,18 @@ As seen above, Python allows many tricks, and some of them are potentially
189189
dangerous. A good example is that any client code can override an object's
190190
properties and methods: there is no "private" keyword in Python. This
191191
philosophy, very different from highly defensive languages like Java, which
192-
give a lot of mechanism to prevent any misuse, is expressed by the saying: "We
192+
give a lot of mechanisms to prevent any misuse, is expressed by the saying: "We
193193
are consenting adults".
194194

195195
This doesn't mean that, for example, no properties are considered private, and
196196
that no proper encapsulation is possible in Python. But, instead of relying on
197197
concrete walls erected by the developers between their code and other's, the
198-
Python community prefers to rely on a set of convention indicating that these
198+
Python community prefers to rely on a set of conventions indicating that these
199199
elements should not be accessed directly.
200200

201201
The main convention for private properties and implementation details is to
202202
prefix all "internals" with an underscore. If the client code breaks this rule
203-
and access to these marked elements, any misbehavior or problems encountered if
203+
and accesses these marked elements, any misbehavior or problems encountered if
204204
the code is modified is the responsibility of the client code.
205205

206206
Using this convention generously is encouraged: any method or property that is
@@ -215,7 +215,7 @@ Returning values
215215
When a function grows in complexity is not uncommon to use multiple return statements
216216
inside the function's body. However, in order to keep a clear intent and a sustainable
217217
readability level, it is preferable to avoid returning meaningful values from many
218-
output point in the body.
218+
output points in the body.
219219

220220
There are two main cases for returning values in a function: The result of the function
221221
return when it has been processed normally, and the error cases that indicate a wrong
@@ -227,12 +227,12 @@ as None or False, indicating that the function could not perform correctly might
227227
case, it is better to return as early as the incorrect context has been detected. It will
228228
help to flatten the structure of the function: all the code after the return-because-of-error
229229
statement can assume the condition is met to further compute the function's main result.
230-
Having multiple such return statement is often necessary.
230+
Having multiple such return statements is often necessary.
231231

232232
However, when a function has multiple main exit points for its normal course, it becomes
233233
difficult to debug the returned result, and it may be preferable to keep a single exit
234-
point. This will also help factoring out some code paths, and the multiple exit point
235-
is a probable indication that such a refactoring is needed.
234+
point. This will also help factoring out some code paths, and the multiple exit points
235+
are a probable indication that such a refactoring is needed.
236236

237237
.. code-block:: python
238238
@@ -351,7 +351,7 @@ Take the following code for example::
351351
return 's' in l
352352

353353
Even though both functions look identical, because *lookup_dict* is utilizing the fact that dictionaries in python are hashtables, the lookup performance between the two is very different.
354-
Python will have to go through each item in the list to find a matching case, which is time consuming. By analysing the hash of the dictionary finding keys in the dict can be done very quickly.
354+
Python will have to go through each item in the list to find a matching case, which is time consuming. By analysing the hash of the dictionary, finding keys in the dict can be done very quickly.
355355
For more information see this `StackOverflow <http://stackoverflow.com/questions/513882/python-list-vs-dict-for-look-up-table>`_ page.
356356

357357
Zen of Python
@@ -589,9 +589,9 @@ sometimes but is preferably avoided, because of its fragility: a white space
589589
added to the end of the line, after the backslash, will break the code and may
590590
have unexpected results.
591591

592-
A preferred solution is to use parenthesis around your elements. Left with an
592+
A preferred solution is to use parentheses around your elements. Left with an
593593
unclosed parenthesis on an end-of-line the Python interpreter will join the
594-
next line until the parenthesis is closed. The same behavior holds for curly
594+
next line until the parentheses are closed. The same behavior holds for curly
595595
and square braces.
596596

597597
**Bad**:

0 commit comments

Comments
 (0)