Commit f725b958 authored by Georg Brandl's avatar Georg Brandl

Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.

parent 6265833d
......@@ -746,7 +746,7 @@ type objects) *must* have the :attr:`ob_size` field.
indicated by the :const:`Py_TPFLAGS_HAVE_RICHCOMPARE` flag bit) and have *NULL*
values.
The following bit masks are currently defined; these can be or-ed together using
The following bit masks are currently defined; these can be ORed together using
the ``|`` operator to form the value of the :attr:`tp_flags` field. The macro
:cfunc:`PyType_HasFeature` takes a type and a flags value, *tp* and *f*, and
checks whether ``tp->tp_flags & f`` is non-zero.
......
......@@ -109,7 +109,7 @@ The module defines the following functions:
* :const:`LOCK_EX` -- acquire an exclusive lock
When *operation* is :const:`LOCK_SH` or :const:`LOCK_EX`, it can also be
bit-wise OR'd with :const:`LOCK_NB` to avoid blocking on lock acquisition.
bitwise ORed with :const:`LOCK_NB` to avoid blocking on lock acquisition.
If :const:`LOCK_NB` is used and the lock cannot be acquired, an
:exc:`IOError` will be raised and the exception will have an *errno*
attribute set to :const:`EACCES` or :const:`EAGAIN` (depending on the
......
......@@ -216,7 +216,7 @@ available. They are listed here in alphabetical order.
the *flags* argument is it -- the future statements in effect around the call to
compile are ignored.
Future statements are specified by bits which can be bitwise or-ed together to
Future statements are specified by bits which can be bitwise ORed together to
specify multiple statements. The bitfield required to specify a given feature
can be found as the :attr:`compiler_flag` attribute on the :class:`_Feature`
instance in the :mod:`__future__` module.
......
......@@ -67,7 +67,7 @@ File Operations
.. function:: open_osfhandle(handle, flags)
Create a C runtime file descriptor from the file handle *handle*. The *flags*
parameter should be a bit-wise OR of :const:`os.O_APPEND`, :const:`os.O_RDONLY`,
parameter should be a bitwise OR of :const:`os.O_APPEND`, :const:`os.O_RDONLY`,
and :const:`os.O_TEXT`. The returned file descriptor may be used as a parameter
to :func:`os.fdopen` to create a file object.
......
This diff is collapsed.
......@@ -398,7 +398,7 @@ for bit-strings. Negative numbers are treated as their 2's complement value
(for long integers, this assumes a sufficiently large number of bits that no
overflow occurs during the operation).
The priorities of the binary bit-wise operations are all lower than the numeric
The priorities of the binary bitwise operations are all lower than the numeric
operations and higher than the comparisons; the unary operation ``~`` has the
same priority as the other unary numeric operations (``+`` and ``-``).
......@@ -2029,7 +2029,12 @@ Files have the following methods:
argument is optional and defaults to ``os.SEEK_SET`` or ``0`` (absolute file
positioning); other values are ``os.SEEK_CUR`` or ``1`` (seek relative to the
current position) and ``os.SEEK_END`` or ``2`` (seek relative to the file's
end). There is no return value. Note that if the file is opened for appending
end). There is no return value.
For example, ``f.seek(2, os.SEEK_CUR)`` advances the position by two and
``f.seek(-3, os.SEEK_END)`` sets the position to the third to last.
Note that if the file is opened for appending
(mode ``'a'`` or ``'a+'``), any :meth:`seek` operations will be undone at the
next write. If the file is only opened for writing in append mode (mode
``'a'``), this method is essentially a no-op, but it remains useful for files
......
......@@ -36,7 +36,7 @@ provided by Windows platforms. It includes functions and several constants.
Call the underlying :cfunc:`PlaySound` function from the Platform API. The
*sound* parameter may be a filename, audio data as a string, or ``None``. Its
interpretation depends on the value of *flags*, which can be a bit-wise ORed
interpretation depends on the value of *flags*, which can be a bitwise ORed
combination of the constants described below. If the system indicates an error,
:exc:`RuntimeError` is raised.
......
......@@ -811,9 +811,9 @@ Unary arithmetic operations
.. index::
triple: unary; arithmetic; operation
triple: unary; bit-wise; operation
triple: unary; bitwise; operation
All unary arithmetic (and bit-wise) operations have the same priority:
All unary arithmetic (and bitwise) operations have the same priority:
.. productionlist::
u_expr: `power` | "-" `u_expr` | "+" `u_expr` | "~" `u_expr`
......@@ -830,8 +830,8 @@ The unary ``+`` (plus) operator yields its numeric argument unchanged.
.. index:: single: inversion
The unary ``~`` (invert) operator yields the bit-wise inversion of its plain or
long integer argument. The bit-wise inversion of ``x`` is defined as
The unary ``~`` (invert) operator yields the bitwise inversion of its plain or
long integer argument. The bitwise inversion of ``x`` is defined as
``-(x+1)``. It only applies to integral numbers.
.. index:: exception: TypeError
......@@ -944,10 +944,10 @@ Negative shift counts raise a :exc:`ValueError` exception.
.. _bitwise:
Binary bit-wise operations
==========================
Binary bitwise operations
=========================
.. index:: triple: binary; bit-wise; operation
.. index:: triple: binary; bitwise; operation
Each of the three bitwise operations has a different priority level:
......@@ -956,20 +956,20 @@ Each of the three bitwise operations has a different priority level:
xor_expr: `and_expr` | `xor_expr` "^" `and_expr`
or_expr: `xor_expr` | `or_expr` "|" `xor_expr`
.. index:: pair: bit-wise; and
.. index:: pair: bitwise; and
The ``&`` operator yields the bitwise AND of its arguments, which must be plain
or long integers. The arguments are converted to a common type.
.. index::
pair: bit-wise; xor
pair: bitwise; xor
pair: exclusive; or
The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
must be plain or long integers. The arguments are converted to a common type.
.. index::
pair: bit-wise; or
pair: bitwise; or
pair: inclusive; or
The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
......
......@@ -909,7 +909,7 @@ Tests of `DocTestRunner`'s option flag handling.
Several option flags can be used to customize the behavior of the test
runner. These are defined as module constants in doctest, and passed
to the DocTestRunner constructor (multiple constants should be or-ed
to the DocTestRunner constructor (multiple constants should be ORed
together).
The DONT_ACCEPT_TRUE_FOR_1 flag disables matches between True/False
......
......@@ -378,7 +378,7 @@ following values:\n\
LOCK_SH - acquire a shared lock\n\
LOCK_EX - acquire an exclusive lock\n\
\n\
When operation is LOCK_SH or LOCK_EX, it can also be bit-wise OR'd with\n\
When operation is LOCK_SH or LOCK_EX, it can also be bitwise ORed with\n\
LOCK_NB to avoid blocking on lock acquisition. If LOCK_NB is used and the\n\
lock cannot be acquired, an IOError will be raised and the exception will\n\
have an errno attribute set to EACCES or EAGAIN (depending on the operating\n\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment