From ab3a2504b97d5131779f400717dc491919783dd0 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 1 Aug 1994 12:18:36 +0000 Subject: libsocket.tex: send[to] returns nbytes. libstring.tex: added count(). ref2.tex: new keywords; moved keyword printing program to keywords.py. --- Doc/keywords.py | 20 ++++++++++++++++++++ Doc/lib/libsocket.tex | 4 ++-- Doc/lib/libstring.tex | 6 ++++++ Doc/libsocket.tex | 4 ++-- Doc/libstring.tex | 6 ++++++ Doc/tools/keywords.py | 20 ++++++++++++++++++++ 6 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 Doc/keywords.py create mode 100644 Doc/tools/keywords.py diff --git a/Doc/keywords.py b/Doc/keywords.py new file mode 100644 index 0000000..52b4d68 --- /dev/null +++ b/Doc/keywords.py @@ -0,0 +1,20 @@ +#! /usr/local/bin/python + +# This Python program sorts and reformats the table of keywords in ref2.tex + +import string +l = [] +try: + while 1: + l = l + string.split(raw_input()) +except EOFError: + pass +l.sort() +for x in l[:]: + while l.count(x) > 1: l.remove(x) +ncols = 5 +nrows = (len(l)+ncols-1)/ncols +for i in range(nrows): + for j in range(i, len(l), nrows): + print string.ljust(l[j], 10), + print diff --git a/Doc/lib/libsocket.tex b/Doc/lib/libsocket.tex index 8599451..7596a86 100644 --- a/Doc/lib/libsocket.tex +++ b/Doc/lib/libsocket.tex @@ -193,13 +193,13 @@ socket sending the data. \begin{funcdesc}{send}{string} Send data to the socket. The socket must be connected to a remote -socket. +socket. Return the number of bytes sent. \end{funcdesc} \begin{funcdesc}{sendto}{string\, address} Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by -\code{address}. +\code{address}. Return the number of bytes sent. (The format of \var{address} depends on the address family -- see above.) \end{funcdesc} diff --git a/Doc/lib/libstring.tex b/Doc/lib/libstring.tex index 2bcbdfc..bf7ad09 100644 --- a/Doc/lib/libstring.tex +++ b/Doc/lib/libstring.tex @@ -130,6 +130,12 @@ Like \code{rfind} but raise \code{index_error} when the substring is not found. \end{funcdesc} +\begin{funcdesc}{count}{s\, sub\, i} +Return the number of (non-overlapping) occurrences of substring +\var{sub} in string \var{s} with index at least \var{i}. +If \var{i} is omitted, it defaults to \code{0}. +\end{funcdesc} + \begin{funcdesc}{lower}{s} Convert letters to lower case. \end{funcdesc} diff --git a/Doc/libsocket.tex b/Doc/libsocket.tex index 8599451..7596a86 100644 --- a/Doc/libsocket.tex +++ b/Doc/libsocket.tex @@ -193,13 +193,13 @@ socket sending the data. \begin{funcdesc}{send}{string} Send data to the socket. The socket must be connected to a remote -socket. +socket. Return the number of bytes sent. \end{funcdesc} \begin{funcdesc}{sendto}{string\, address} Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by -\code{address}. +\code{address}. Return the number of bytes sent. (The format of \var{address} depends on the address family -- see above.) \end{funcdesc} diff --git a/Doc/libstring.tex b/Doc/libstring.tex index 2bcbdfc..bf7ad09 100644 --- a/Doc/libstring.tex +++ b/Doc/libstring.tex @@ -130,6 +130,12 @@ Like \code{rfind} but raise \code{index_error} when the substring is not found. \end{funcdesc} +\begin{funcdesc}{count}{s\, sub\, i} +Return the number of (non-overlapping) occurrences of substring +\var{sub} in string \var{s} with index at least \var{i}. +If \var{i} is omitted, it defaults to \code{0}. +\end{funcdesc} + \begin{funcdesc}{lower}{s} Convert letters to lower case. \end{funcdesc} diff --git a/Doc/tools/keywords.py b/Doc/tools/keywords.py new file mode 100644 index 0000000..52b4d68 --- /dev/null +++ b/Doc/tools/keywords.py @@ -0,0 +1,20 @@ +#! /usr/local/bin/python + +# This Python program sorts and reformats the table of keywords in ref2.tex + +import string +l = [] +try: + while 1: + l = l + string.split(raw_input()) +except EOFError: + pass +l.sort() +for x in l[:]: + while l.count(x) > 1: l.remove(x) +ncols = 5 +nrows = (len(l)+ncols-1)/ncols +for i in range(nrows): + for j in range(i, len(l), nrows): + print string.ljust(l[j], 10), + print -- cgit v0.12