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

Skip to content

Commit 9fe394c

Browse files
committed
Merged revisions 53538-53622 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r53545 | andrew.kuchling | 2007-01-24 21:06:41 +0100 (Wed, 24 Jan 2007) | 1 line Strengthen warning about using lock() ........ r53556 | thomas.heller | 2007-01-25 19:34:14 +0100 (Thu, 25 Jan 2007) | 3 lines Fix for #1643874: When calling SysAllocString, create a PyCObject which will eventually call SysFreeString to free the BSTR resource. ........ r53563 | andrew.kuchling | 2007-01-25 21:02:13 +0100 (Thu, 25 Jan 2007) | 1 line Add item ........ r53564 | brett.cannon | 2007-01-25 21:22:02 +0100 (Thu, 25 Jan 2007) | 8 lines Fix time.strptime's %U support. Basically rewrote the algorithm to be more generic so that one only has to shift certain values based on whether the week was specified to start on Monday or Sunday. Cut out a lot of edge case code compared to the previous version. Also broke algorithm out into its own function (that is private to the module). Fixes bug #1643943 (thanks Biran Nahas for the report). ........ r53570 | brett.cannon | 2007-01-26 00:30:39 +0100 (Fri, 26 Jan 2007) | 4 lines Remove specific mention of my name and email address from modules. Not really needed and all bug reports should go to the bug tracker, not directly to me. Plus I am not the only person to have edited these files at this point. ........ r53573 | fred.drake | 2007-01-26 17:28:44 +0100 (Fri, 26 Jan 2007) | 1 line fix typo (extraneous ")") ........ r53575 | georg.brandl | 2007-01-27 18:43:02 +0100 (Sat, 27 Jan 2007) | 4 lines Patch #1638243: the compiler package is now able to correctly compile a with statement; previously, executing code containing a with statement compiled by the compiler package crashed the interpreter. ........ r53578 | georg.brandl | 2007-01-27 18:59:42 +0100 (Sat, 27 Jan 2007) | 3 lines Patch #1634778: add missing encoding aliases for iso8859_15 and iso8859_16. ........ r53579 | georg.brandl | 2007-01-27 20:38:50 +0100 (Sat, 27 Jan 2007) | 2 lines Bug #1645944: os.access now returns bool but docstring is not updated ........ r53590 | brett.cannon | 2007-01-28 21:58:00 +0100 (Sun, 28 Jan 2007) | 2 lines Use the thread lock's context manager instead of a try/finally statement. ........ r53591 | brett.cannon | 2007-01-29 05:41:44 +0100 (Mon, 29 Jan 2007) | 2 lines Add a test for slicing an exception. ........ r53594 | andrew.kuchling | 2007-01-29 21:21:43 +0100 (Mon, 29 Jan 2007) | 1 line Minor edits to the curses HOWTO ........ r53596 | andrew.kuchling | 2007-01-29 21:55:40 +0100 (Mon, 29 Jan 2007) | 1 line Various minor edits ........ r53597 | andrew.kuchling | 2007-01-29 22:28:48 +0100 (Mon, 29 Jan 2007) | 1 line More edits ........ r53601 | tim.peters | 2007-01-30 04:03:46 +0100 (Tue, 30 Jan 2007) | 2 lines Whitespace normalization. ........ r53603 | georg.brandl | 2007-01-30 21:21:30 +0100 (Tue, 30 Jan 2007) | 2 lines Bug #1648191: typo in docs. ........ r53605 | brett.cannon | 2007-01-30 22:34:36 +0100 (Tue, 30 Jan 2007) | 8 lines No more raising of string exceptions! The next step of PEP 352 (for 2.6) causes raising a string exception to trigger a TypeError. Trying to catch a string exception raises a DeprecationWarning. References to string exceptions has been removed from the docs since they are now just an error. ........ r53618 | raymond.hettinger | 2007-02-01 22:02:59 +0100 (Thu, 01 Feb 2007) | 1 line Bug #1648179: set.update() not recognizing __iter__ overrides in dict subclasses. ........
1 parent 08f0046 commit 9fe394c

46 files changed

Lines changed: 468 additions & 348 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/howto/TODO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Short-term tasks:
3-
Quick revision pass to make HOWTOs match the current state of Python:
4-
curses doanddont regex sockets sorting
3+
Quick revision pass to make HOWTOs match the current state of Python
4+
doanddont regex sockets
55

66
Medium-term tasks:
77
Revisit the regex howto.

Doc/howto/curses.tex

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
\title{Curses Programming with Python}
44

5-
\release{2.01}
5+
\release{2.02}
66

77
\author{A.M. Kuchling, Eric S. Raymond}
88
\authoraddress{\email{[email protected]}, \email{[email protected]}}
@@ -147,10 +147,10 @@ \section{Starting and ending a curses application}
147147

148148
In Python you can avoid these complications and make debugging much
149149
easier by importing the module \module{curses.wrapper}. It supplies a
150-
function \function{wrapper} that takes a hook argument. It does the
150+
\function{wrapper()} function that takes a callable. It does the
151151
initializations described above, and also initializes colors if color
152-
support is present. It then runs your hook, and then finally
153-
deinitializes appropriately. The hook is called inside a try-catch
152+
support is present. It then runs your provided callable and finally
153+
deinitializes appropriately. The callable is called inside a try-catch
154154
clause which catches exceptions, performs curses deinitialization, and
155155
then passes the exception upwards. Thus, your terminal won't be left
156156
in a funny state on exception.
@@ -159,7 +159,7 @@ \section{Windows and Pads}
159159

160160
Windows are the basic abstraction in curses. A window object
161161
represents a rectangular area of the screen, and supports various
162-
methods to display text, erase it, allow the user to input strings,
162+
methods to display text, erase it, allow the user to input strings,
163163
and so forth.
164164

165165
The \code{stdscr} object returned by the \function{initscr()} function
@@ -223,14 +223,14 @@ \section{Windows and Pads}
223223

224224
The \function{refresh()} call displays a section of the pad in the
225225
rectangle extending from coordinate (5,5) to coordinate (20,75) on the
226-
screen;the upper left corner of the displayed section is coordinate
226+
screen; the upper left corner of the displayed section is coordinate
227227
(0,0) on the pad. Beyond that difference, pads are exactly like
228228
ordinary windows and support the same methods.
229229

230230
If you have multiple windows and pads on screen there is a more
231231
efficient way to go, which will prevent annoying screen flicker at
232-
refresh time. Use the methods \method{noutrefresh()} and/or
233-
\method{noutrefresh()} of each window to update the data structure
232+
refresh time. Use the \method{noutrefresh()} method
233+
of each window to update the data structure
234234
representing the desired state of the screen; then change the physical
235235
screen to match the desired state in one go with the function
236236
\function{doupdate()}. The normal \method{refresh()} method calls
@@ -254,9 +254,9 @@ \section{Displaying Text}
254254

255255
\begin{tableii}{|c|l|}{textrm}{Form}{Description}
256256
\lineii{\var{str} or \var{ch}}{Display the string \var{str} or
257-
character \var{ch}}
257+
character \var{ch} at the current position}
258258
\lineii{\var{str} or \var{ch}, \var{attr}}{Display the string \var{str} or
259-
character \var{ch}, using attribute \var{attr}}
259+
character \var{ch}, using attribute \var{attr} at the current position}
260260
\lineii{\var{y}, \var{x}, \var{str} or \var{ch}}
261261
{Move to position \var{y,x} within the window, and display \var{str}
262262
or \var{ch}}
@@ -271,7 +271,7 @@ \section{Displaying Text}
271271

272272
The \function{addstr()} function takes a Python string as the value to
273273
be displayed, while the \function{addch()} functions take a character,
274-
which can be either a Python string of length 1, or an integer. If
274+
which can be either a Python string of length 1 or an integer. If
275275
it's a string, you're limited to displaying characters between 0 and
276276
255. SVr4 curses provides constants for extension characters; these
277277
constants are integers greater than 255. For example,
@@ -331,15 +331,15 @@ \subsection{Attributes and Color}
331331
provide it, The most common such terminal is probably the Linux
332332
console, followed by color xterms.
333333

334-
To use color, you must call the \function{start_color()} function
335-
soon after calling \function{initscr()}, to initialize the default
336-
color set (the \function{curses.wrapper.wrapper()} function does this
334+
To use color, you must call the \function{start_color()} function soon
335+
after calling \function{initscr()}, to initialize the default color
336+
set (the \function{curses.wrapper.wrapper()} function does this
337337
automatically). Once that's done, the \function{has_colors()}
338338
function returns TRUE if the terminal in use can actually display
339-
color. (Note from AMK: curses uses the American spelling
340-
'color', instead of the Canadian/British spelling 'colour'. If you're
341-
like me, you'll have to resign yourself to misspelling it for the sake
342-
of these functions.)
339+
color. (Note: curses uses the American spelling 'color', instead of
340+
the Canadian/British spelling 'colour'. If you're used to the British
341+
spelling, you'll have to resign yourself to misspelling it for the
342+
sake of these functions.)
343343

344344
The curses library maintains a finite number of color pairs,
345345
containing a foreground (or text) color and a background color. You
@@ -400,18 +400,19 @@ \section{User Input}
400400
lack.
401401

402402
The most common way to get input to a window is to use its
403-
\method{getch()} method. that pauses, and waits for the user to hit
404-
a key, displaying it if \function{echo()} has been called earlier.
405-
You can optionally specify a coordinate to which the cursor should be
406-
moved before pausing.
403+
\method{getch()} method. \method{getch()} pauses and waits for the
404+
user to hit a key, displaying it if \function{echo()} has been called
405+
earlier. You can optionally specify a coordinate to which the cursor
406+
should be moved before pausing.
407407

408408
It's possible to change this behavior with the method
409409
\method{nodelay()}. After \method{nodelay(1)}, \method{getch()} for
410-
the window becomes non-blocking and returns ERR (-1) when no input is
411-
ready. There's also a \function{halfdelay()} function, which can be
412-
used to (in effect) set a timer on each \method{getch()}; if no input
413-
becomes available within the number of milliseconds specified as the
414-
argument to \function{halfdelay()}, curses throws an exception.
410+
the window becomes non-blocking and returns \code{curses.ERR} (a value
411+
of -1) when no input is ready. There's also a \function{halfdelay()}
412+
function, which can be used to (in effect) set a timer on each
413+
\method{getch()}; if no input becomes available within the number of
414+
milliseconds specified as the argument to \function{halfdelay()},
415+
curses raises an exception.
415416

416417
The \method{getch()} method returns an integer; if it's between 0 and
417418
255, it represents the ASCII code of the key pressed. Values greater

Doc/howto/doanddont.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ \subsection{from module import *}
3232
\subsubsection{Inside Function Definitions}
3333

3434
\code{from module import *} is {\em invalid} inside function definitions.
35-
While many versions of Python do no check for the invalidity, it does not
35+
While many versions of Python do not check for the invalidity, it does not
3636
make it more valid, no more then having a smart lawyer makes a man innocent.
3737
Do not use it like that ever. Even in versions where it was accepted, it made
3838
the function execution slower, because the compiler could not be certain

0 commit comments

Comments
 (0)