Fix typos and tweak the return value of dict_get_version(d)
This commit is contained in:
parent
11e9267809
commit
f730565241
12
pep-0509.txt
12
pep-0509.txt
|
@ -179,7 +179,7 @@ Example using an hypothetical ``dict_get_version(dict)`` function::
|
|||
If a dictionary is created with items, the version is also incremented
|
||||
at each dictionary insertion. Example::
|
||||
|
||||
>>> d=dict(x=7, y=33)
|
||||
>>> d = dict(x=7, y=33)
|
||||
>>> dict_get_version(d)
|
||||
2
|
||||
|
||||
|
@ -188,14 +188,14 @@ value. For efficiency, values are compared by their identity:
|
|||
``new_value is old_value``, not by their content:
|
||||
``new_value == old_value``. Example::
|
||||
|
||||
>>> d={}
|
||||
>>> d = {}
|
||||
>>> value = object()
|
||||
>>> d['key'] = value
|
||||
>>> dict_get_version(d)
|
||||
2
|
||||
1
|
||||
>>> d['key'] = value
|
||||
>>> dict_get_version(d)
|
||||
2
|
||||
1
|
||||
|
||||
.. note::
|
||||
CPython uses some singleton like integers in the range [-5; 257],
|
||||
|
@ -233,7 +233,7 @@ then continue to be incremented) according to the C standard.
|
|||
After an integer overflow, a guard can succeed whereas the watched
|
||||
dictionary key was modified. The bug occurs if the dictionary is
|
||||
modified at least ``2 ** 64`` times between two checks of the guard and
|
||||
if the new version (theorical value with no integer overflow) is equal
|
||||
if the new version (theoretical value with no integer overflow) is equal
|
||||
to the old version modulo ``2 ** 64``.
|
||||
|
||||
If a dictionary is modified each nanosecond, an overflow takes longer
|
||||
|
@ -373,7 +373,7 @@ expecting the exact ``dict`` type. Issues:
|
|||
``PyObject_xxx()`` if the object is a ``dict`` subtype
|
||||
* ``PyDict_CheckExact()`` check fails on ``dict`` subtype, whereas some
|
||||
functions require the exact ``dict`` type.
|
||||
* ``Python/ceval.c`` does not completly supports dict subtypes for
|
||||
* ``Python/ceval.c`` does not completely supports dict subtypes for
|
||||
namespaces
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ latest CPython stable version is 3.5, whereas PyPy only supports Python
|
|||
Even if PyPy has a very good compatibility with Python, some modules are
|
||||
still not compatible with PyPy: see `PyPy Compatibility Wiki
|
||||
<https://bitbucket.org/pypy/compatibility/wiki/Home>`_. The incomplete
|
||||
support of the the Python C API is part of this problem. There are also
|
||||
support of the Python C API is part of this problem. There are also
|
||||
subtle differences between PyPy and CPython like reference counting:
|
||||
object destructors are always called in PyPy, but can be called "later"
|
||||
than in CPython. Using context managers helps to control when resources
|
||||
|
@ -393,7 +393,7 @@ its index::
|
|||
|
||||
int PyFunction_RemoveSpecialized(PyObject *func, Py_ssize_t index)
|
||||
|
||||
Return ``0`` on sucess or if the index does not exist. Raise an exception and
|
||||
Return ``0`` on success or if the index does not exist. Raise an exception and
|
||||
return ``-1`` on error.
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue