Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df872a2

Browse files
committed
No need to be ambiguous about *how* extended slices and built-in types
have changed. Uncomment a heading so that PendingDeprecationWarning doesn't seem so out of place.
1 parent 228f6e4 commit df872a2

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

Doc/whatsnew/whatsnew23.tex

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,28 @@ \section{PEP 285: The \class{bool} Type\label{section-bool}}
343343
\section{Extended Slices\label{extended-slices}}
344344

345345
Ever since Python 1.4 the slice syntax has supported a third
346-
``stride'' argument, but the builtin sequence types have not supported
347-
this feature (it was initially included at the behest of the
348-
developers of the Numerical Python package). This changes with Python
349-
2.3.
346+
``stride'' argument, but the built-in sequence types have not
347+
supported this feature (it was initially included at the behest of the
348+
developers of the Numerical Python package). Starting with Python
349+
2.3, the built-in sequence types do support the stride.
350350

351-
% XXX examples, etc.
351+
For example, to extract the elements of a list with even indexes:
352+
353+
\begin{verbatim}
354+
>>> L = range(10)
355+
>>> L[::2]
356+
[0, 2, 4, 6, 8]
357+
\end{verbatim}
358+
359+
To make a copy of the same list in reverse order:
360+
361+
\begin{verbatim}
362+
>>> L[::-1]
363+
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
364+
\end{verbatim}
352365

353366
%======================================================================
354-
%\section{Other Language Changes}
367+
\section{Other Language Changes}
355368

356369
%Here are the changes that Python 2.3 makes to the core language.
357370

@@ -368,11 +381,12 @@ \section{Extended Slices\label{extended-slices}}
368381

369382

370383
%\begin{PendingDeprecationWarning}
371-
A new warning PendingDeprecationWarning was added to provide
372-
direction on features which are in the process of being deprecated.
373-
The warning will not be printed by default. To see the pending
374-
deprecations, use -Walways::PendingDeprecationWarning:: on the command line
375-
or warnings.filterwarnings().
384+
A new warning, \exception{PendingDeprecationWarning} was added to
385+
provide direction on features which are in the process of being
386+
deprecated. The warning will not be printed by default. To see the
387+
pending deprecations, use
388+
\programopt{-Walways::PendingDeprecationWarning::} on the command line
389+
or use \function{warnings.filterwarnings()}.
376390
%\end{PendingDeprecationWarning}
377391

378392

0 commit comments

Comments
 (0)