Skip to content

Commit

Permalink
Spelling fixes and semantic (both ways) corrections by Aahz Maruch, B…
Browse files Browse the repository at this point in the history
…jorn

Pettersen and Eric Jacobs.
  • Loading branch information
Yhg1s committed Aug 14, 2000
1 parent 31f50af commit 7c9c4a8
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions pep-0203.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Introduction
slated for introduction in Python 2.0. It contains a description
of the feature and outlines changes necessary to support the
feature. This PEP summarizes discussions held in mailing list
forums, and provides URLs for further information, where
forums, and provides URLs for further information where
appropriate. The CVS revision history of this file contains the
definitive historical record.

Expand Down Expand Up @@ -52,7 +52,7 @@ Proposed semantics
itself.

To make this possible, a number of new `hooks' are added to Python
classes and C extention types, which are called when the object in
classes and C extension types, which are called when the object in
question is used as the left hand side of an augmented assignment
operation. If the class or type does not implement the `in-place'
hooks, the normal hooks for the particular binary operation are
Expand All @@ -67,11 +67,11 @@ Proposed semantics
attempted, and finally y.__radd__(x) if __add__ is missing too.
There is no `right-hand-side' variant of __add_ab__, because that
would require for `y' to know how to in-place modify `x', which is
an unsafe to say the least. The __add_ab__ hook should behave exactly
like __add__, returning the result of the operation (which could
be `self') which is to be stored in the variable `x'.
unsafe to say the least. The __add_ab__ hook should behave similar
to __add__, returning the result of the operation (which could be
`self') which is to be stored in the variable `x'.

For C extention types, the `hooks' are members of the
For C extension types, the `hooks' are members of the
PyNumberMethods and PySequenceMethods structures, and are called
in exactly the same manner as the existing non-inplace operations,
including argument coercion. C methods should also take care to
Expand All @@ -89,7 +89,7 @@ Rationale
assignment doesn't add anything that was previously impossible. It
merely makes these things easier to do.

Adding augmented assignment will make Pythons syntax more complex.
Adding augmented assignment will make Python's syntax more complex.
Instead of a single assignment operation, there are now twelve
assignment operations, eleven of which also perform an binary
operation. However, these eleven new forms of assignment are easy
Expand All @@ -102,7 +102,7 @@ Rationale
<x> = <x> <operator> <y>

are common enough in those languages to make the extra syntax
worthwhile, and Python does not have significantly less of those
worthwhile, and Python does not have significantly fewer of those
expressions. Quite the opposite, in fact, since in Python you can
also concatenate lists with a binary operator, something that is
done quite frequently. Writing the above expression as
Expand All @@ -118,15 +118,15 @@ Rationale
calculation and other applications that require large objects. In
order to efficiently deal with the available program memory, such
packages cannot blindly use the current binary operations. Because
these operations always create a new character, adding a single
item to an existing (large) object would result in copying the
entire object (which may cause the application to run out of
memory), add the single item, and then possibly delete the
original object, depending on reference count.
these operations always create a new object, adding a single item
to an existing (large) object would result in copying the entire
object (which may cause the application to run out of memory), add
the single item, and then possibly delete the original object,
depending on reference count.

To work around this problem, the packages currently have to use
methods or functions to modify an object in-place, which is
definately less readable than an augmented assignment expression.
definitely less readable than an augmented assignment expression.
Augmented assignment won't solve all the problems for these
packages, since some operations cannot be expressed in the limited
set of binary operators to start with, but it is a start. A
Expand Down Expand Up @@ -156,7 +156,7 @@ New methods
`__add_in__' and `__inplace_add__'. A firm decision by the BDFL is
probably needed to finalize this issue.

For C extention types, the following struct members are added:
For C extension types, the following struct members are added:

To PyNumberMethods:
binaryfunc nb_inplace_add;
Expand Down Expand Up @@ -195,7 +195,7 @@ New methods
Implementation

The current implementation of augmented assignment[2] adds, in
addition to the methods and slots alread covered, 13 new bytecodes
addition to the methods and slots already covered, 13 new bytecodes
and 13 new API functions.

The API functions are simply in-place versions of the current
Expand Down Expand Up @@ -305,7 +305,8 @@ References
[1] http://www.python.org/pipermail/python-list/2000-June/059556.html
[2]
http://sourceforge.net/patch?func=detailpatch&patch_id=100699&group_id=5470

[3] PEP 211, Adding New Linear Algebra Operators,
http://python.sourceforge.net/peps/pep-0211.html


Local Variables:
Expand Down

0 comments on commit 7c9c4a8

Please sign in to comment.