Kaydet (Commit) b7754e12 authored tarafından Fred Drake's avatar Fred Drake

Fix SF bug #1061770: Manual typesets bit-shift operators as guillemet

üst 512f2eee
...@@ -316,8 +316,9 @@ priority (operations in the same box have the same priority): ...@@ -316,8 +316,9 @@ priority (operations in the same box have the same priority):
\lineiii{\var{x} | \var{y}}{bitwise \dfn{or} of \var{x} and \var{y}}{} \lineiii{\var{x} | \var{y}}{bitwise \dfn{or} of \var{x} and \var{y}}{}
\lineiii{\var{x} \^{} \var{y}}{bitwise \dfn{exclusive or} of \var{x} and \var{y}}{} \lineiii{\var{x} \^{} \var{y}}{bitwise \dfn{exclusive or} of \var{x} and \var{y}}{}
\lineiii{\var{x} \&{} \var{y}}{bitwise \dfn{and} of \var{x} and \var{y}}{} \lineiii{\var{x} \&{} \var{y}}{bitwise \dfn{and} of \var{x} and \var{y}}{}
\lineiii{\var{x} << \var{n}}{\var{x} shifted left by \var{n} bits}{(1), (2)} % The empty groups below prevent conversion to guillemets.
\lineiii{\var{x} >> \var{n}}{\var{x} shifted right by \var{n} bits}{(1), (3)} \lineiii{\var{x} <{}< \var{n}}{\var{x} shifted left by \var{n} bits}{(1), (2)}
\lineiii{\var{x} >{}> \var{n}}{\var{x} shifted right by \var{n} bits}{(1), (3)}
\hline \hline
\lineiii{\~\var{x}}{the bits of \var{x} inverted}{} \lineiii{\~\var{x}}{the bits of \var{x} inverted}{}
\end{tableiii} \end{tableiii}
......
...@@ -753,9 +753,10 @@ The shifting operations have lower priority than the arithmetic ...@@ -753,9 +753,10 @@ The shifting operations have lower priority than the arithmetic
operations: operations:
\begin{productionlist} \begin{productionlist}
% The empty groups below prevent conversion to guillemets.
\production{shift_expr} \production{shift_expr}
{\token{a_expr} {\token{a_expr}
| \token{shift_expr} ( "<<" | ">>" ) \token{a_expr}} | \token{shift_expr} ( "<{}<" | ">{}>" ) \token{a_expr}}
\end{productionlist} \end{productionlist}
These operators accept plain or long integers as arguments. The These operators accept plain or long integers as arguments. The
......
...@@ -275,7 +275,8 @@ operation and an assignment statement: ...@@ -275,7 +275,8 @@ operation and an assignment statement:
{\token{target} \token{augop} \token{expression_list}} {\token{target} \token{augop} \token{expression_list}}
\production{augop} \production{augop}
{"+=" | "-=" | "*=" | "/=" | "\%=" | "**="} {"+=" | "-=" | "*=" | "/=" | "\%=" | "**="}
\productioncont{| ">>=" | "<<=" | "\&=" | "\textasciicircum=" | "|="} % The empty groups below prevent conversion to guillemets.
\productioncont{| ">{}>=" | "<{}<=" | "\&=" | "\textasciicircum=" | "|="}
\end{productionlist} \end{productionlist}
(See section~\ref{primaries} for the syntax definitions for the last (See section~\ref{primaries} for the syntax definitions for the last
......
...@@ -394,9 +394,10 @@ been added to Python 2.0. Augmented assignment operators include ...@@ -394,9 +394,10 @@ been added to Python 2.0. Augmented assignment operators include
statement \code{a += 2} increments the value of the variable statement \code{a += 2} increments the value of the variable
\code{a} by 2, equivalent to the slightly lengthier \code{a = a + 2}. \code{a} by 2, equivalent to the slightly lengthier \code{a = a + 2}.
% The empty groups below prevent conversion to guillemets.
The full list of supported assignment operators is \code{+=}, The full list of supported assignment operators is \code{+=},
\code{-=}, \code{*=}, \code{/=}, \code{\%=}, \code{**=}, \code{\&=}, \code{-=}, \code{*=}, \code{/=}, \code{\%=}, \code{**=}, \code{\&=},
\code{|=}, \verb|^=|, \code{>>=}, and \code{<<=}. Python classes can \code{|=}, \verb|^=|, \code{>{}>=}, and \code{<{}<=}. Python classes can
override the augmented assignment operators by defining methods named override the augmented assignment operators by defining methods named
\method{__iadd__}, \method{__isub__}, etc. For example, the following \method{__iadd__}, \method{__isub__}, etc. For example, the following
\class{Number} class stores a number and supports using += to create a \class{Number} class stores a number and supports using += to create a
......
...@@ -2344,13 +2344,15 @@ exists. ...@@ -2344,13 +2344,15 @@ exists.
they're stored as 32-bit numbers and result in a negative value, but they're stored as 32-bit numbers and result in a negative value, but
in Python 2.4 they'll become positive long integers. in Python 2.4 they'll become positive long integers.
% The empty groups below prevent conversion to guillemets.
There are a few ways to fix this warning. If you really need a There are a few ways to fix this warning. If you really need a
positive number, just add an \samp{L} to the end of the literal. If positive number, just add an \samp{L} to the end of the literal. If
you're trying to get a 32-bit integer with low bits set and have you're trying to get a 32-bit integer with low bits set and have
previously used an expression such as \code{~(1 << 31)}, it's probably previously used an expression such as \code{\textasciitilde(1 <{}< 31)},
it's probably
clearest to start with all bits set and clear the desired upper bits. clearest to start with all bits set and clear the desired upper bits.
For example, to clear just the top bit (bit 31), you could write For example, to clear just the top bit (bit 31), you could write
\code{0xffffffffL {\&}{\textasciitilde}(1L<<31)}. \code{0xffffffffL {\&}{\textasciitilde}(1L<{}<31)}.
\item You can no longer disable assertions by assigning to \code{__debug__}. \item You can no longer disable assertions by assigning to \code{__debug__}.
......
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