You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(10) |
Oct
(11) |
Nov
(8) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(12) |
Feb
(7) |
Mar
(21) |
Apr
(5) |
May
(4) |
Jun
(1) |
Jul
(33) |
Aug
(5) |
Sep
(13) |
Oct
(16) |
Nov
(2) |
Dec
(6) |
2002 |
Jan
|
Feb
|
Mar
(6) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
2003 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: A.M. K. <aku...@us...> - 2003-12-20 21:49:41
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv25111 Modified Files: sorting.tex Log Message: Fix example Index: sorting.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/sorting.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** sorting.tex 26 Nov 2002 16:02:16 -0000 1.6 --- sorting.tex 20 Dec 2003 21:49:38 -0000 1.7 *************** *** 105,109 **** >>> a.reverse() >>> print a ! [1, 2, 3, 4, 5] \end{verbatim} --- 105,109 ---- >>> a.reverse() >>> print a ! [5, 4, 3, 2, 1] \end{verbatim} |
From: A.M. K. <aku...@us...> - 2003-04-20 18:38:11
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv11079 Modified Files: curses.tex Log Message: Remove use of \and Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** curses.tex 26 Nov 2002 16:08:10 -0000 1.22 --- curses.tex 20 Apr 2003 18:38:06 -0000 1.23 *************** *** 5,9 **** \release{2.01} ! \author{A.M. Kuchling \and\ Eric S. Raymond} \authoraddress{\email{am...@am...}, \email{es...@th...}} --- 5,9 ---- \release{2.01} ! \author{A.M. Kuchling, Eric S. Raymond} \authoraddress{\email{am...@am...}, \email{es...@th...}} |
From: A.M. K. <aku...@us...> - 2003-04-18 13:56:07
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv24637 Modified Files: regex.tex Log Message: Comment out this paragraph, because it seems to be impossible to get [\^] to display correctly in both DVI/PDF output and HTML output at the same time. The paragraph isn't that critical, and I'm sick of having to mess with it, endlessly, fruitlessly. Things like this make me glad that TeX is dying. Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** regex.tex 18 Apr 2003 13:45:41 -0000 1.19 --- regex.tex 18 Apr 2003 13:56:01 -0000 1.20 *************** *** 704,709 **** \end{verbatim} ! To match a literal \character{\^}, use \regexp{\e\^} or enclose it ! inside a character class, as in \regexp{[{\e}\^]}. \item[\regexp{\$}] Matches at the end of a line, which is defined as --- 704,709 ---- \end{verbatim} ! %To match a literal \character{\^}, use \regexp{\e\^} or enclose it ! %inside a character class, as in \regexp{[{\e}\^]}. \item[\regexp{\$}] Matches at the end of a line, which is defined as |
From: A.M. K. <aku...@us...> - 2003-04-18 13:45:47
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv20033 Modified Files: regex.tex Log Message: Various rewrites and tweaks suggested by Jeffrey Elkner Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** regex.tex 10 Apr 2003 14:18:34 -0000 1.18 --- regex.tex 18 Apr 2003 13:45:41 -0000 1.19 *************** *** 94,107 **** \begin{verbatim} ! . ^ $ * + ? { [ \ | ( ) \end{verbatim} % $ ! The first metacharacter we'll look at is \samp{[}; it's used for ! specifying a character class, which is a set of characters that you ! wish to match. Characters can be listed individually, or a range of ! characters can be indicated by giving two characters and separating ! them by a \character{-}. For example, \regexp{[abc]} will match any ! of the characters \samp{a}, \samp{b}, or \samp{c}; this is the same as \regexp{[a-c]}, which uses a range to express the same set of characters. If you wanted to match only lowercase letters, your --- 94,108 ---- \begin{verbatim} ! . ^ $ * + ? { [ ] \ | ( ) \end{verbatim} % $ ! The first metacharacters we'll look at are \samp{[} and \samp{]}. ! They're used for specifying a character class, which is a set of ! characters that you wish to match. Characters can be listed ! individually, or a range of characters can be indicated by giving two ! characters and separating them by a \character{-}. For example, ! \regexp{[abc]} will match any of the characters \samp{a}, \samp{b}, or ! \samp{c}; this is the same as \regexp{[a-c]}, which uses a range to express the same set of characters. If you wanted to match only lowercase letters, your *************** *** 165,173 **** Being able to match varying sets of characters is the first thing ! regular expressions can do that isn't already possible with Python's ! \module{string} module. However, if that was the only additional ! capability of regexes, they wouldn't be much of an advance. Another ! capability is that you can specify that portions of the RE must be ! repeated a certain number of times. The first metacharacter for repeating things that we'll look at is --- 166,174 ---- Being able to match varying sets of characters is the first thing ! regular expressions can do that isn't already possible with the ! methods available on strings. However, if that was the only ! additional capability of regexes, they wouldn't be much of an advance. ! Another capability is that you can specify that portions of the RE ! must be repeated a certain number of times. The first metacharacter for repeating things that we'll look at is *************** *** 221,225 **** Another repeating metacharacter is \regexp{+}, which matches one or more times. Pay careful attention to the difference between ! \regexp{*} and \\regexp{+}; \regexp{*} matches \emph{zero} or more times, so whatever's being repeated may not be present at all, while \regexp{+} requires at least \emph{one} occurrence. To use a similar --- 222,226 ---- Another repeating metacharacter is \regexp{+}, which matches one or more times. Pay careful attention to the difference between ! \regexp{*} and \regexp{+}; \regexp{*} matches \emph{zero} or more times, so whatever's being repeated may not be present at all, while \regexp{+} requires at least \emph{one} occurrence. To use a similar *************** *** 365,372 **** You can learn about this by interactively experimenting with the \module{re} module. If you have Tkinter available, you may also want ! to look at \file{redemo.py}, a demonstration program included with the ! Python distribution. It allows you to enter REs and strings, and ! displays whether the RE matches or fails. \file{redemo.py} can be ! quite useful when trying to debug a complicated RE. Phil Schwartz's \ulink{Kodos}{http://kodos.sourceforge.net} is also an interactive tool for developing and testing RE patterns. This HOWTO will use the --- 366,374 ---- You can learn about this by interactively experimenting with the \module{re} module. If you have Tkinter available, you may also want ! to look at \file{Tools/scripts/redemo.py}, a demonstration program ! included with the Python distribution. It allows you to enter REs and ! strings, and displays whether the RE matches or fails. ! \file{redemo.py} can be quite useful when trying to debug a ! complicated RE. Phil Schwartz's \ulink{Kodos}{http://kodos.sourceforge.net} is also an interactive tool for developing and testing RE patterns. This HOWTO will use the *************** *** 381,385 **** >>> p = re.compile('[a-z]+') >>> p ! <re.RegexObject instance at 80c3c28> \end{verbatim} --- 383,387 ---- >>> p = re.compile('[a-z]+') >>> p ! <_sre.SRE_Pattern object at 80c3c28> \end{verbatim} *************** *** 405,409 **** >>> m = p.match( 'tempo') >>> print m ! <re.MatchObject instance at 80c4f68> \end{verbatim} --- 407,411 ---- >>> m = p.match( 'tempo') >>> print m ! <_sre.SRE_Match object at 80c4f68> \end{verbatim} *************** *** 629,634 **** \begin{verbatim} charref = re.compile(r""" ! &\# # Start of a numeric entity reference ! (?P<char> [0-9]+[^0-9] # Decimal form | 0[0-7]+[^0-7] # Octal form --- 631,636 ---- \begin{verbatim} charref = re.compile(r""" ! &[#] # Start of a numeric entity reference ! ( [0-9]+[^0-9] # Decimal form | 0[0-7]+[^0-7] # Octal form *************** *** 640,644 **** Without the verbose setting, the RE would look like this: \begin{verbatim} ! charref = re.compile("&#(?P<char>[0-9]+[^0-9]" "|0[0-7]+[^0-7]" "|x[0-9a-fA-F]+[^0-9a-fA-F])") --- 642,646 ---- Without the verbose setting, the RE would look like this: \begin{verbatim} ! charref = re.compile("&#([0-9]+[^0-9]" "|0[0-7]+[^0-7]" "|x[0-9a-fA-F]+[^0-9a-fA-F])") *************** *** 903,907 **** Python adds an extension syntax to Perl's extension syntax. If the first character after the question mark is a \samp{P}, you know that ! it's a extension that's specific to Python. Currently there are two such extensions: \regexp{(?P<\var{name}>...)} defines a named group, and \regexp{(?P=\var{name})} is a backreference to a named group. If --- 905,909 ---- Python adds an extension syntax to Perl's extension syntax. If the first character after the question mark is a \samp{P}, you know that ! it's an extension that's specific to Python. Currently there are two such extensions: \regexp{(?P<\var{name}>...)} defines a named group, and \regexp{(?P=\var{name})} is a backreference to a named group. If |
From: A.M. K. <aku...@us...> - 2003-04-10 14:18:40
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv11351 Modified Files: regex.tex Log Message: [Patch #718809 from Jarno Virtanen] Various minor corrections to regex.tex; I've also made a few more minor rewrites. Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** regex.tex 7 Apr 2003 19:51:23 -0000 1.17 --- regex.tex 10 Apr 2003 14:18:34 -0000 1.18 *************** *** 35,40 **** Perl-style regular expression patterns. Earlier versions of Python came with the \module{regex} module, which provides Emacs-style ! patterns. Emacs-style patterns are slightly less readable, and ! doesn't provide as many features, so there's not much reason to use the \module{regex} module when writing new code, though you might encounter old code that uses it. --- 35,40 ---- Perl-style regular expression patterns. Earlier versions of Python came with the \module{regex} module, which provides Emacs-style ! patterns. Emacs-style patterns are slightly less readable and ! don't provide as many features, so there's not much reason to use the \module{regex} module when writing new code, though you might encounter old code that uses it. *************** *** 215,219 **** it can at first, and if no match is found it will then progressively back up and retry the rest of the RE again and again. It will back up ! until it's tried zero matches for \regexp{[bcd]*}, and if that subsequently fails, the engine will conclude that the string doesn't match the RE at all. --- 215,219 ---- it can at first, and if no match is found it will then progressively back up and retry the rest of the RE again and again. It will back up ! until it has tried zero matches for \regexp{[bcd]*}, and if that subsequently fails, the engine will conclude that the string doesn't match the RE at all. *************** *** 245,249 **** earlier, but that might as well be infinity. ! Readers of a reductionist bent may notice that the 3 other qualifiers can all be expressed using this notation. \regexp{\{0,\}} is the same as \regexp{*}, \regexp{\{1,\}} is equivalent to \regexp{+}, and --- 245,249 ---- earlier, but that might as well be infinity. ! Readers of a reductionist bent may notice that the three other qualifiers can all be expressed using this notation. \regexp{\{0,\}} is the same as \regexp{*}, \regexp{\{1,\}} is equivalent to \regexp{+}, and *************** *** 348,354 **** \begin{tableii}{c|l}{code}{Method/Attribute}{Purpose} ! \lineii{match}{Determine if the RE matches at the beginning of the string.} ! \lineii{search}{Scan through a string, looking for any location where this RE matches.} \lineii{findall()}{Find all substrings where the RE matches, --- 348,354 ---- \begin{tableii}{c|l}{code}{Method/Attribute}{Purpose} ! \lineii{match()}{Determine if the RE matches at the beginning of the string.} ! \lineii{search()}{Scan through a string, looking for any location where this RE matches.} \lineii{findall()}{Find all substrings where the RE matches, *************** *** 997,1001 **** \end{verbatim} ! \subsection{Other Assertions} Another zero-width assertion is the lookahead assertion. Lookahead --- 997,1001 ---- \end{verbatim} ! \subsection{Lookahead Assertions} Another zero-width assertion is the lookahead assertion. Lookahead *************** *** 1016,1020 **** \end{itemize} ! An example will help make this concrete and will demonstrate a case where a lookahead is useful. Consider a simple pattern to match a filename and split it apart into a base name and an extension, --- 1016,1020 ---- \end{itemize} ! An example will help make this concrete by demonstrating a case where a lookahead is useful. Consider a simple pattern to match a filename and split it apart into a base name and an extension, *************** *** 1022,1030 **** is the base name, and \samp{rc} is the filename's extension. ! The pattern to match this is quite simple: \regexp{.*[.].*\$}. ! (Notice that the \samp{.} needs to be treated specially because it's a metacharacter; I've put it inside a character class. Also notice the trailing \regexp{\$}; this is added to ensure that all the rest of the ! string must be included in the extension.) This regular expression matches \samp{foo.bar} and \samp{autoexec.bat} and \samp{sendmail.cf} and \samp{printers.conf}. --- 1022,1033 ---- is the base name, and \samp{rc} is the filename's extension. ! The pattern to match this is quite simple: ! ! \regexp{.*[.].*\$} ! ! Notice that the \samp{.} needs to be treated specially because it's a metacharacter; I've put it inside a character class. Also notice the trailing \regexp{\$}; this is added to ensure that all the rest of the ! string must be included in the extension. This regular expression matches \samp{foo.bar} and \samp{autoexec.bat} and \samp{sendmail.cf} and \samp{printers.conf}. *************** *** 1037,1045 **** % $ ! First attempt: Exclude \samp{bat} by requiring that the first ! character of the extension is not a \samp{b}. This is wrong, because it ! also doesn't match \samp{foo.bar}. ! \regexp{.*[.]([\^b]..|.[\^a].|..[\^t])\$} The expression gets messier when you try to patch up the first --- 1040,1049 ---- % $ ! The first attempt above tries to exclude \samp{bat} by requiring that ! the first character of the extension is not a \samp{b}. This is ! wrong, because the pattern also doesn't match \samp{foo.bar}. ! % Messes up the HTML without the curly braces around \^ ! \regexp{.*[.]([{\^}b]..|.[{\^}a].|..[{\^}t])\$} The expression gets messier when you try to patch up the first *************** *** 1048,1056 **** \samp{a}; or the third character isn't \samp{t}. This accepts \samp{foo.bar} and rejects \samp{autoexec.bat}, but it requires a ! three-letter extension, and doesn't accept \samp{sendmail.cf}. ! Another bug, so we'll complicate the pattern again in an effort to fix ! it. ! \regexp{.*[.]([\^b].?.?|.[\^a]?.?|..?[\^t]?)\$} In the third attempt, the second and third letters are all made --- 1052,1060 ---- \samp{a}; or the third character isn't \samp{t}. This accepts \samp{foo.bar} and rejects \samp{autoexec.bat}, but it requires a ! three-letter extension and won't accept a filename with a two-letter ! extension such as \samp{sendmail.cf}. We'll complicate the pattern ! again in an effort to fix it. ! \regexp{.*[.]([{\^}b].?.?|.[{\^}a]?.?|..?[{\^}t]?)\$} In the third attempt, the second and third letters are all made *************** *** 1059,1081 **** The pattern's getting really complicated now, which makes it hard to ! read and understand. Worse, this solution doesn't scale well; if the ! problem changes and you want to exclude both \samp{bat} and \samp{exe} ! as extensions, the pattern would get still more complicated and ! confusing. ! ! A negative lookahead cuts through all this. Go back to the original ! pattern, and, before the \regexp{.*} which matches the extension, ! insert \regexp{(?!bat\$)}. This means: if the expression \regexp{bat} ! doesn't match at this point, try the rest of the pattern; if ! \regexp{bat\$} does match, the whole pattern will fail. The trailing ! \regexp{\$} is required to ensure that something like ! \samp{sample.batch}, where the extension only starts with \samp{bat}, ! will be allowed. ! ! After this modification, the whole pattern is ! \regexp{.*[.](?!bat\$).*\$}. Excluding another filename extension is ! now easy; simply add it as an alternative inside the assertion. \regexp{.*[.](?!bat\$|exe\$).*\$} ! excludes both \samp{bat} and \samp{exe}. --- 1063,1087 ---- The pattern's getting really complicated now, which makes it hard to ! read and understand. Worse, if the problem changes and you want to ! exclude both \samp{bat} and \samp{exe} as extensions, the pattern ! would get even more complicated and confusing. ! ! A negative lookahead cuts through all this: ! ! \regexp{.*[.](?!bat\$).*\$} ! % $ ! ! The lookahead means: if the expression \regexp{bat} doesn't match at ! this point, try the rest of the pattern; if \regexp{bat\$} does match, ! the whole pattern will fail. The trailing \regexp{\$} is required to ! ensure that something like \samp{sample.batch}, where the extension ! only starts with \samp{bat}, will be allowed. ! ! Excluding another filename extension is now easy; simply add it as an ! alternative inside the assertion. The following pattern excludes ! filenames that end in either \samp{bat} or \samp{exe}: ! \regexp{.*[.](?!bat\$|exe\$).*\$} ! % $ *************** *** 1087,1093 **** \begin{tableii}{c|l}{code}{Method/Attribute}{Purpose} ! \lineii{split}{Split the string into a list, splitting it wherever the RE matches} ! \lineii{sub}{Find all substrings where the RE matches, and replace them with a different string} ! \lineii{subn}{Does the same thing as \method{sub()}, but returns the new string and the number of replacements} \end{tableii} --- 1093,1099 ---- \begin{tableii}{c|l}{code}{Method/Attribute}{Purpose} ! \lineii{split()}{Split the string into a list, splitting it wherever the RE matches} ! \lineii{sub()}{Find all substrings where the RE matches, and replace them with a different string} ! \lineii{subn()}{Does the same thing as \method{sub()}, but returns the new string and the number of replacements} \end{tableii} *************** *** 1193,1197 **** \end{verbatim} ! Empty matches are replaced only when not they're not adjacent to a previous match. --- 1199,1203 ---- \end{verbatim} ! Empty matches are replaced only when they're not adjacent to a previous match. *************** *** 1223,1229 **** There's also a syntax for referring to named groups as defined by the \regexp{(?P<name>...)} syntax. \samp{\e g<name>} will use the ! substring matched by the group named \samp{name}, and \samp{\e ! g<\var{number}>} uses the corresponding group number. \samp{\e g<2>} ! is therefore equivalent to \samp{\e 2}, but isn't ambiguous in a replacement string such as \samp{\e g<2>0}. (\samp{\e 20} would be interpreted as a reference to group 20, not a reference to group 2 --- 1229,1237 ---- There's also a syntax for referring to named groups as defined by the \regexp{(?P<name>...)} syntax. \samp{\e g<name>} will use the ! substring matched by the group named \samp{name}, and ! \samp{\e g<\var{number}>} ! uses the corresponding group number. ! \samp{\e g<2>} is therefore equivalent to \samp{\e 2}, ! but isn't ambiguous in a replacement string such as \samp{\e g<2>0}. (\samp{\e 20} would be interpreted as a reference to group 20, not a reference to group 2 *************** *** 1303,1309 **** from a string or replacing it with another single character. You might do this with something like \code{re.sub('\e n', ' ', S)}, but ! \method{translate()} is capable of doing both these tasks, ! and will be much faster that any regular expression operation can ever ! be. In short, before turning to the \module{re} module, consider whether --- 1311,1316 ---- from a string or replacing it with another single character. You might do this with something like \code{re.sub('\e n', ' ', S)}, but ! \method{translate()} is capable of doing both tasks ! and will be faster that any regular expression operation can be. In short, before turning to the \module{re} module, consider whether *************** *** 1347,1351 **** starting character, only trying the full match if a \character{C} is found. ! Adding \regexp{.*} defeats this optimization, and requires scanning to the end of the string and then backtracking to find a match for the rest of the RE. Use \function{re.search()} instead. --- 1354,1358 ---- starting character, only trying the full match if a \character{C} is found. ! Adding \regexp{.*} defeats this optimization, requiring scanning to the end of the string and then backtracking to find a match for the rest of the RE. Use \function{re.search()} instead. |
From: A.M. K. <aku...@us...> - 2003-04-07 19:51:32
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv7696 Modified Files: regex.tex Log Message: Describe findall() and finditer(); bump version number Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** regex.tex 6 Apr 2003 23:35:20 -0000 1.16 --- regex.tex 7 Apr 2003 19:51:23 -0000 1.17 *************** *** 3,7 **** % TODO: % Document lookbehind assertions - % Add section on findall, finditer methods % Better way of displaying a RE, a string, and what it matches % Mention optional argument to match.groups() --- 3,6 ---- *************** *** 10,14 **** \title{Regular Expression HOWTO} ! \release{0.04} \author{A.M. Kuchling} --- 9,13 ---- \title{Regular Expression HOWTO} ! \release{0.05} \author{A.M. Kuchling} *************** *** 465,468 **** --- 464,494 ---- \end{verbatim} + Two \class{RegexObject} methods return all of the matches for a pattern. + \method{findall()} returns a list of matching strings: + + \begin{verbatim} + >>> p = re.compile('\d+') + >>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping') + ['12', '11', '10'] + \end{verbatim} + + \method{findall()} has to create the entire list before it can be + returned as the result. In Python 2.2, the \method{finditer()} method + is also available, returning a sequence of \class{MatchObject} instances + as an iterator. + + \begin{verbatim} + >>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...') + >>> iterator + <callable-iterator object at 0x401833ac> + >>> for match in iterator: + ... print match.span() + ... + (0, 2) + (22, 24) + (29, 31) + \end{verbatim} + + \subsection{Module-Level Functions} *************** *** 1372,1376 **** HTML or XML parser module for such tasks.) ! \subsection{Not using re.VERBOSE} By now you've probably noticed that regular expressions are a very --- 1398,1402 ---- HTML or XML parser module for such tasks.) ! \subsection{Not Using re.VERBOSE} By now you've probably noticed that regular expressions are a very |
From: A.M. K. <aku...@us...> - 2003-04-06 23:35:23
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv31212 Modified Files: regex.tex Log Message: Numerous rewrites and fixes Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** regex.tex 28 Feb 2003 18:02:40 -0000 1.15 --- regex.tex 6 Apr 2003 23:35:20 -0000 1.16 *************** *** 2,9 **** % TODO: ! % Document lookbehind assertions, conditionals, (?>...) ! % Document findall, finditer methods % Better way of displaying a RE, a string, and what it matches - % Show how to loop with search() % Mention optional argument to match.groups() % Unicode (at least a reference) --- 2,8 ---- [...1322 lines suppressed...] - example, \regexp{Isaac (?=Asimov)} will match \code{'Isaac~'} only if it's - followed by \code{'Asimov'}. - - \item[\code{(?!...)}] Matches if \regexp{...} doesn't match next. This - is a negative lookahead assertion. For example, - \regexp{Isaac (?!Asimov)} will match \code{'Isaac~'} only if it's \emph{not} - followed by \code{'Asimov'}. --- 1420,1431 ---- The most complete book on regular expressions is almost certainly ! Jeffrey Friedl's \citetitle{Mastering Regular Expressions}, published ! by O'Reilly. Unfortunately, it exclusively concentrates on Perl and Java's flavours of regular expressions, and doesn't contain any Python ! material at all, so it won't be useful as a reference for programming ! in Python. (The first edition covered Python's now-obsolete ! \module{regex} module, which won't help you much.) Consider checking ! it out from your library. \end{document} |
From: A.M. K. <aku...@us...> - 2003-02-28 18:02:44
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv1992 Modified Files: regex.tex Log Message: Update the reference to the Friedl book, which no longer covers Python at all Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** regex.tex 19 Feb 2003 21:00:34 -0000 1.14 --- regex.tex 28 Feb 2003 18:02:40 -0000 1.15 *************** *** 3,12 **** % TODO: % Document lookbehind assertions, conditionals, (?>...) ! % Document findall method (once 1.5.2 is fairly widespread) % Better way of displaying a RE, a string, and what it matches % Show how to loop with search() % Mention optional argument to match.groups() % Unicode (at least a reference) - % Update reference to Friedl book \title{Regular Expression HOWTO} --- 3,11 ---- % TODO: % Document lookbehind assertions, conditionals, (?>...) ! % Document findall, finditer methods % Better way of displaying a RE, a string, and what it matches % Show how to loop with search() % Mention optional argument to match.groups() % Unicode (at least a reference) \title{Regular Expression HOWTO} *************** *** 1382,1390 **** The most complete book on regular expressions is almost certainly ! Jeffrey Friedl's \emph{Mastering Regular Expressions}, published by ! O'Reilly. Unfortunately, the Python material in this book dates from ! before the \module{re} module --- all the examples use the old ! \module{regex} module --- but it covers writing good regular ! expressions in great detail. \end{document} --- 1381,1389 ---- The most complete book on regular expressions is almost certainly ! Jeffrey Friedl's \citetitle{Mastering Regular Expressions}, published by ! O'Reilly. Unfortunately, it exclusively concentrates on Perl and ! Java's flavours of regular expressions, and doesn't contain any Python ! material at all. (The first edition covered the obsolete ! \module{regex} module.) \end{document} |
From: A.M. K. <aku...@us...> - 2003-02-19 21:01:12
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv18729 Modified Files: regex.tex Log Message: Add some more TODO items Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** regex.tex 26 Nov 2002 16:05:50 -0000 1.13 --- regex.tex 19 Feb 2003 21:00:34 -0000 1.14 *************** *** 6,9 **** --- 6,12 ---- % Better way of displaying a RE, a string, and what it matches % Show how to loop with search() + % Mention optional argument to match.groups() + % Unicode (at least a reference) + % Update reference to Friedl book \title{Regular Expression HOWTO} |
From: A.M. K. <aku...@us...> - 2003-01-08 13:15:11
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv12770 Modified Files: rexec.tex Log Message: Add more details about rexec's problems Index: rexec.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/rexec.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** rexec.tex 17 Dec 2002 14:31:42 -0000 1.13 --- rexec.tex 8 Jan 2003 13:15:07 -0000 1.14 *************** *** 15,25 **** \noindent ! Python provides a \module{rexec} module running untrusted code. ! However, it's never been exhaustively audited for security and it ! hasn't been updated to take into account recent changes to Python such ! as new-style classes. Therefore, the \module{rexec} module should not be trusted. To discourage use of \module{rexec}, this HOWTO has been withdrawn. \end{abstract} --- 15,37 ---- \noindent ! Python 2.2.2 and earlier provided a \module{rexec} module running ! untrusted code. However, it's never been exhaustively audited for ! security and it hasn't been updated to take into account recent ! changes to Python such as new-style classes. Therefore, the \module{rexec} module should not be trusted. To discourage use of \module{rexec}, this HOWTO has been withdrawn. + The \module{rexec} and \module{Bastion} modules have been disabled in + the Python CVS tree, both on the trunk (which will eventually become + Python 2.3alpha2 and later 2.3final) and on the release22-maint branch + (which will become Python 2.2.3, if someone ever volunteers to issue + 2.2.3). + + For discussion of the problems with \module{rexec}, see the python-dev + threads starting at the following URLs: + \url{http://mail.python.org/pipermail/python-dev/2002-December/031160.html}, + and + \url{http://mail.python.org/pipermail/python-dev/2003-January/031848.html}. + \end{abstract} *************** *** 39,42 **** --- 51,57 ---- Dec. 17, 2002: Withdrawn. + + Jan. 8, 2003: Mention that \module{rexec} will be disabled in Python 2.3, + and added links to relevant python-dev threads. \end{document} |
From: A.M. K. <aku...@us...> - 2002-12-17 14:31:49
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv3716 Modified Files: rexec.tex Log Message: Withdraw the rexec HOWTO Index: rexec.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/rexec.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** rexec.tex 26 Nov 2002 16:05:50 -0000 1.12 --- rexec.tex 17 Dec 2002 14:31:42 -0000 1.13 *************** *** 3,7 **** \title{Restricted Execution HOWTO} ! \release{2.0} \author{A.M. Kuchling} --- 3,7 ---- \title{Restricted Execution HOWTO} ! \release{2.1} \author{A.M. Kuchling} *************** *** 14,559 **** \begin{abstract} \noindent - Python provides a restricted execution mode for running untrusted code - that will prevent the code from performing dangerous operations. This - HOWTO explains how to use restricted execution mode, and how to - customize the restricted environment for your application. It aims to - provide a gentler introduction than the corresponding section in the - Python Library Reference. ! This document is available from the Python HOWTO page at ! \url{http://www.python.org/doc/howto}. \end{abstract} - \tableofcontents - - \section{Basic use of \class{RExec}} - - For some applications, it's desirable to execute chunks of Python code - that come from an outside source. The most obvious example is a Web - browser such as Grail, which can download and execute applets written in - Python. - - An obvious danger of downloading and running code from anywhere is that - someone might write a malicious applet that appears to be harmless, but - silently erases files, makes copies of sensitive data, or gives the - applet's author a back door into your system. The solution is to run - the code in a restricted environment, where it's prevented from - performing any operations that could be used maliciously. - - Java does this by using the Java Virtual Machine, which executes Java - bytecode. The virtual machine, or VM, has complete control over the - running applet, and any dangerous operations must go through the VM in - order to be performed. The VM can therefore trap suspicious activity, - and stop the applet's execution, if a strict security policy is used, or - ask the user if the operation should be permitted, if the policy is - somewhat looser. - - Python already has a virtual machine that executes Python byte codes, so - creating a restricted execution environment simply requires sealing off - dangerous built-in functions such as \code{open()}, and dangerous - modules, such as the \code{socket} module. This can be done by creating - new namespaces, removing any dangerous functions, and forcing code to be - executed in those namespaces. While a simple idea, in practice it's - fairly complicated to implement. Luckily, the required features have - been present in Python for a while, and it's already been implemented - for you as a standard module. - - Code for using a restricted execution environment is in the \file{rexec} - module. The base class is called \class{RExec}; in a later section of - this HOWTO, we'll show you how to create your own subclasses of - \class{RExec} to customize the functions and modules that are available. - Here's the documentation for creating a new \class{RExec} instance: - - \begin{funcdesc}{RExec}{[\var{hooks}], [\var{verbose}] } - Returns a \class{RExec} instance. The \var{verbose} parameter is a - Boolean value, defaulting to false. If true, the \class{RExec} instance - will execute in verbose mode, which will print a debugging message when - modules are imported, as if the \code{-v} option was given to the Python - interpreter. - - The \var{hooks} parameter can be an instance of the \code{RHooks} - class, or of some subclass of \code{RHooks}; a default instance will - be used if the parameter is omitted. This is only required when - creating particularly exotic restricted environments that import - modules in new ways. If you need to use this, you'll have to - consult the source code (or Guido) for a complete picture of what's - going on. - \end{funcdesc} - - The \class{RExec} instance has \code{r_exec()}, \code{r_eval()}, and - \code{r_execfile()} functions, which do the same thing as Python's - built-in \code{exec()}, \code{eval()}, and \code{execfile()} functions, - performing them in the restricted environment. (There are also - \code{s_exec()}, \code{s_eval()}, and \code{s_execfile()} methods which - replace the restricted environment's standard input, output, and error - files with \code{StringIO} objects that allow you to control the input - and capture any output generated.) - - Here's a sample usage of a restricted environment. First, the - \class{RExec} instance has to be created. - - \begin{verbatim} - r_env = rexec.RExec() - \end{verbatim} - - Now, we can execute code and evaluate expressions - in the environment: - - \begin{verbatim} - r_env.r_exec('import string') - expr = 'string.upper("This is a test")' - print r_env.r_eval( expr ) - \end{verbatim} - - The first line executes a statement, importing the \code{string} module. - Since it's considered a safe module, the operation succeeds. The second - and third lines create a string containing an expression, and evaluates - the expression in the restricted environment; it prints out \samp{THIS - IS A TEST}, as you'd expect. - - Unsafe operations trigger an exception. For example: - - \begin{verbatim} - r_env.r_exec('import socket') - \end{verbatim} - - The previous line will cause an \code{ImportError} exception to be - raised, with an associated string value that reads "untrusted dynamic - module: _socket". Trying to open a file for writing is also forbidden: - - \begin{verbatim} - r_env.r_exec('file = open("/tmp/a.out", "w")') - \end{verbatim} - - This will raise an \code{IOError} exception, with an assocated string - value that reads "can't open files for writing in restricted mode". The - restricted code can catch the exception in a \code{try...except} block - and continue running; this is useful for writing code which works in - both restricted and unrestricted mode. Opening files for reading will - work, however. - - Exactly what restrictions does the base \class{RExec} impose? It limits - the modules that can be imported to the following safe list: - - \begin{verbatim} - audioop, array, binascii, cmath, errno, imageop, - marshal, math, md5, operator, parser, regex, - pcre, rotor, select, strop, struct, time - \end{verbatim} - - In general, these are modules that can't affect anything outside of - the executing code; they allow various forms of computation, but don't - allow operations that change the filesystem or use network connections - to other machines. (The \code{pcre} module may be unfamiliar. It's - an internal module used by the \module{re} module, so restricted code - can still use the \module{re} to perform regular expression matches.) - - It also restricts the variables and functions that are available from - the \code{sys} and \code{os} modules. The \code{sys} module only - contains the following symbols: - - \begin{verbatim} - ps1, ps2, copyright, version, platform, exit, maxint - \end{verbatim} - - The \code{os} module is reduced to the following functions: - - \begin{verbatim} - error, fstat, listdir, lstat, readlink, - stat, times, uname, getpid, getppid, - getcwd, getuid, getgid, geteuid, getegid - \end{verbatim} - - Note that restricted code has some read-only access to the filesystem - via functions like \code{os.stat} and \code{os.readlink}; if you wish to - forbid all access to the filename, these functions must be removed. - - In restricted mode, there are various attributes of function and class - objects that are no longer accessible: the \code{__dict__} attribute of - class, instance and module objects; the \code{__self__} attribute of - method objects; and most of the attributes of function objects, namely - \code{func_code}, \code{func_defaults}, \code{func_doc}, - \code{func_globals}, and \code{func_name}. - - The \code{__import__()} and \code{reload()} functions are replaced by - versions which implement the above restrictions. Finally, Python's - usual \code{open()} function is removed and replaced by a restricted - version that only allows opening files for reading. - - To change any of these policies, whether to be stricter or looser, see - the section below on customizing the restricted environment. - - \section{Frequently Asked Questions} - - \emph{How do I guard against denial-of-service attacks? Or, how do I - keep restricted code from consuming a lot of memory?} - - Even if restricted code can't open sockets or write files, it can still - cause problems by entering an infinite loop or consuming lots of memory; - this is as easy as coding \code{while 1: pass} or \code{'a' * - 12345678901}. Unfortunately, there's no way at present to prevent - restricted code from doing this. The Python process may therefore - encounter a \code{MemoryError} exception, loop forever, or be killed by - the operating system. - - One solution would be to perform \code{os.fork()} to get a child process - running the interpreter. The child could then use the \code{resource} - module to set limits on the amount of memory, stack space, and CPU time - it can consume, and run the restricted code. In the meantime, the - parent process can set a timeout and wait for the child to return its - results; if the child takes too long, the parent can conclude that the - restricted code looped forever, and kill the child process. - - \emph{If restricted code returns a class instance via \code{r_eval()}, - can that class instance do nasty things if unrestricted code calls its - methods?} - - You might be worried about the handling of values returned by - \code{r_eval()}. For example, let's say your program does this: - - \begin{verbatim} - value = r_env.r_eval( expression ) - print str(value) - \end{verbatim} - - If \code{value} is a class instance, and has a \code{__str__} method, - that method will get called by the \code{str()} function. Is it - possible for the restricted code to return a class instance where the - \code{__str__} function does something nasty? Does this provide a way - for restricted code to smuggle out code that gets run without - restrictions? - - The answer is no. If restricted code returns a class instance, or a - function, then, despite being called by unrestricted code, those - functions will always be executed in the restricted environment. You - can see why if you follow this little exercise. Run the interpreter in - interactive mode, and create a sample class with a single method. - - \begin{verbatim} - >>> class C: - ... def f(self): print "Hi!" - ... - \end{verbatim} - - Now, look at the attributes of the unbound method \code{C.f}: - - \begin{verbatim} - >>> dir(C.f) - ['__doc__', '__name__', 'im_class', 'im_func', 'im_self'] - \end{verbatim} - - \code{im_func} is the attribute we're interested in; it contains the - actual function for the method. Look at the function's attributes using - the \code{dir()} built-in function, and then look at the - \code{func_globals} attribute. - - \begin{verbatim} - >>> dir(C.f.im_func) - ['__doc__', '__name__', 'func_code', 'func_defaults', 'func_doc', - 'func_globals', 'func_name'] - >>> C.f.im_func.func_globals - {'__doc__': None, '__name__': '__main__', - '__builtins__': <module '__builtin__'>, - 'f': <function f at 1201a68b0>, - 'C': <class __main__.C at 1201b35e0>, - 'a': <__main__.C instance at 1201a6b10>} - \end{verbatim} - - See how the function contains attributes for its \code{__builtins__} - module? This means that, wherever it goes, the function will always use - the same \code{__builtin__} module, namely the one provided by the - restricted environment. - - This means that the function's module scope is limited to that of the - restricted environment; it has no way to access any variables or - methods in the unrestricted environment that is calling into the - restricted environment. - - \begin{verbatim} - r_env.r_exec('def f(): g()\n') - f = r_env.r_eval('f') - def g(): print "I'm unrestricted." - \end{verbatim} - - If you execute the \code{f()} function in the unrestricted module, it - will fail with a \code{NameError} exception, because \code{f()} doesn't - have access to the unrestricted namespace. To make this work, you'd - must insert \code{g} into the restricted namespace. Be careful when - doing this, since \code{g} will be executed without restrictions; you - have to be sure that \code{g} is a function that can't be used to do - any damage. (Or is an instance with no methods that do anything - dangerous. Or is a module containing no dangerous functions. You get - the idea.) - - - \emph{What happens if restricted code raises an exception?} - - The \module{rexec} module doesn't do anything special for exceptions - raised by restricted code; they'll be propagated up the call stack - until a \code{try...except} statement is found that catches it. If - no exception handler is found, the interpreter will print a traceback and exit, which - is its usual behaviour. To prevent untrusted code from terminating - the program, you should surround calls to \code{r_exec()}, - \code{r_execfile()}, etc. with a \code{try...except} statement. - - Python 1.5 introduced exceptions that could be classes; for more - information about this new feature, consult - \url{http://www.python.org/doc/essays/stdexceptions.html}. - Class-based exceptions present a problem; the separation between - restricted and unrestricted namespaces may cause confusion. Consider - this example code, suggested by Jeff Rush. - - t1.py: - \begin{verbatim} - # t1.py - - from rexec import RHooks, RExec - from t2 import MyException - r= RExec( ) - - print 'MyException class:', repr(MyException) - try: - r.r_execfile('t3.py') - except MyException, args: - print 'Got MyException in t3.py' - except: - print 'Missed MyException "%s" in t3.py' % repr(MyException) - \end{verbatim} - - t2.py - \begin{verbatim} - #t2.py - - class MyException(Exception): pass - def myfunc(): - print 'Raising', `MyException` - raise MyException, 5 - - print 't2 module initialized' - \end{verbatim} - - t3.py: - \begin{verbatim} - #t3.py - import sys - from t2 import MyException, myfunc - myfunc() - \end{verbatim} - - So, \file{t1.py} imports the \code{MyException} class from - \file{t2.py}, and then executes some restricted code that also imports - \file{t2.py} and raises \code{MyException}. However, because of the - separation between restricted and unrestricted code, \code{t2.py} is - actually imported twice, once in each mode. Therefore two distinct - class objects are created for \code{MyException}, and the - \code{except} statement doesn't catch the exception because it seems - to be of the wrong class. - - The solution is to modify \file{t1.py} to pluck the class object out - of the restricted environment, instead of importing it. The following - code will do the job, if added to \code{t1.py}: - - \begin{verbatim} - module = r.add_module('__main__') - mod_dict = module.__dict__ - MyException = mod_dict['MyException'] - \end{verbatim} - - The first two lines simply get the dictionary for the \code{__main__} - module; this is a usage pattern discussed above. The last line simply - gets the value corresponding to 'MyException', which will be the class - object for \code{MyException}. - - \section{Customizing The Restricted Environment} - \label{sect-customizing} - - \subsection{Inserting Variables} - - While restricted code may be completely self-contained, it's common for - it to require other data: perhaps a tuple listing various available - plug-ins, or a dictionary mapping symbols to values. For simple Python - data types, such as numbers and strings, the natural solution is to - insert variables into one of the namespaces used by the restricted - environment, binding the desired variable name to the value. - - Continuing from the examples above, you can get the dictionary - corresponding to the restricted module named \code{module_name} with the - following code: - - \begin{verbatim} - module = r_env.add_module(module_name) - mod_dict = module.__dict__ - \end{verbatim} - - Despite its name, the \code{add_module()} method actually only adds the - module if it doesn't already exist; it returns the corresponding module - object, whether or not the module had to be created. - - Most commonly, you'll insert variable bindings into the \code{__main__} - or \code{__builtins__} module, so these will be the most frequent values - of \code{module_name}. - - Once you have the module's dictionary, you need only insert a key/value - pair for the desired variable name and value. For example, to add a - \code{username} variable: - - \begin{verbatim} - mod_dict['username'] = "Kate Bush" - \end{verbatim} - - Restricted code will then have access to this variable. - - \subsection{Allowing Access to Unrestricted Objects} - - Often, the code being executed will need access to various objects that - exist outside the restricted environment. For example, an applet should - be able to read some attributes of the object representing the browser, - or needs access to the \code{Tkinter} module to provide a GUI display. - But the browser object, or the \code{Tkinter} module aren't safe, so - what can be done? - - The solution is in the \code{Bastion} module, which lets you create - class instances that represent some other Python object, but deny access - to certain sensitive attributes or methods. - - \begin{funcdesc}{Bastion}{\var{object}, [\var{filter}], [\var{name}], - [\var{class}] } - - Return a \code{Bastion} instance protecting the class instance - \var{object}. Any attempt to access one of the object's attributes will - have to be approved by the \var{filter} function; if the access is - denied an \code{AttributeError} exception will be raised. - - If present, \var{filter} must be a function that accepts a string - containing an attribute name, and returns true if access to that - attribute will be permitted; if \var{filter} returns false, the access - is denied. The default filter denies access to any function beginning - with an underscore \samp{_}. The bastion's string representation - will be \code{<Bastion for \var{name}>} if a value for - \var{name} is provided; otherwise, \code{repr(\var{object})} will be used. - - \var{class}, if present, would be a subclass of \code{BastionClass}; - see the code in \file{bastion.py} for the details. Overriding the - default \code{BastionClass} will rarely be required. - \end{funcdesc} - - So, to safely make an object available to restricted code, create a - \code{Bastion} object protecting it, and insert the \code{Bastion} - instance into the restricted environment's namespace. - - For example, the following code will create a bastion for an instance, - named \code{S}, that simulates a dictionary. We want restricted code to - be able to set and retrieve values from \code{S}, but no other - attributes or methods should be accessible. - - \begin{verbatim} - import Bastion - maindict = r_env.modules['__main__'].__dict__ - maindict['S'] = Bastion.Bastion(SS, - filter = lambda name: name in ['__getitem__', '__setitem__'] ) - \end{verbatim} - - \subsection{Modifying Built-ins} - - Often you'll wish to customize the restricted environment in various - ways, most commonly by adding or subtracting variables or functions from - the modules available. At a more advanced level, you might wish to - write replacements for existing functions; for example, a Web browser - that executes Python applets would have an import function that allows - retrieving modules via HTTP and importing them. - - An easy way to add or remove functions is to create the \class{RExec} - instance, get the namespace dictionary for the desired module, and add - or delete the desired function. For example, the \class{RExec} class - provides a restricted \code{open()} that allows opening files for - reading. If you wish to disallow this, you can simply delete 'open' - from the \class{RExec} instance's \code{__builtin__} module. - - \begin{verbatim} - module = r_env.add_module('__builtin__') - mod_dict = module.__dict__ - del mod_dict['open'] - \end{verbatim} - - (This isn't enough to prevent code from accessing the filesystem; - the \class{RExec} class also allows access - via some of the functions in the \code{posix} module, which is usually - aliased to the \code{os} module. See below for how to change this.) - - This is fine if only a single function is being added or removed, but - for more complicated changes, subclassing the \class{RExec} class is a - better idea. - - Subclassing can potentially be quite simple. The \class{RExec} class - defines some class attributes that are used to initialize the restricted - versions of modules such as \code{os} and \code{sys}. Changing the - environment's policy then requires just changing the class attribute in - your subclass. For example, the default environment allows restricted - code to use the \code{posix} module to get its process and group ID. If - you decide to disallow this, you can do it with the following custom - class: - - \begin{verbatim} - class MyRExec(rexec.RExec): - ok_posix_names = ('error', 'fstat', 'listdir', 'lstat', 'readlink', - 'stat', 'times', 'uname') - \end{verbatim} - - More elaborate customizations may require overriding one of the methods - called to create the corresponding module. The functions to be - overridden are \code{make_builtin}, \code{make_main}, - \code{make_osname}, and \code{make_sys}. The \code{r_import}, - \code{r_open}, and \code{r_reload} methods are made available to - restricted code, so by overriding these functions, you can change the - capabilities available. - - For example, defining a new import function requires overriding - \code{r_import}: - - \begin{verbatim} - class MyRExec(rexec.RExec): - def r_import(self, mname, globals={}, locals={}, fromlist=[]): - raise ImportError, "No imports allowed--ever" - \end{verbatim} - - Obviously, a less trivial function could import modules using HTTP, or do something else of interest. - - \section{References} - - See some of the papers on the Knowbot Programming Environment on - CNRI's publications page: ``Knowbot programming: System support for - mobile agents'', at - \url{http://www.cnri.reston.va.us/home/koe/papers/iwooos-full.html}, and ``Using - the Knowbot Operating Environment in a Wide-Area Network'', at - \url{http://www.cnri.reston.va.us/home/koe/papers/mos.html}. - - For information on Java's security model, consult the Java Security - FAQ at \url{http://java.sun.com/sfaq/index.html}. - - Perl supports similar features, via a software package called Penguin - developed by Felix Gallo. - Humberto Ortiz Zuazaga wrote a paper called "The Penguin Model for - Secure Distributed Internet Scripting", at - \url{http://www.hpcf.upr.edu/~humberto/documents/penguin-safe-scripting.html}. - Thanks to Fred Drake for bringing it to my attention. - - Work has also been done on Safe-Tcl; see ``The Safe-Tcl Security - Model'', by Jacob Y. Levy, Laurent Demailly, John K. Ousterhout, and - Brent B. Welch, in the Proceedings of the 1998 USENIX Annual Technical - Conference. Usenix members can access the paper online at - \url{http://www.usenix.org/publications/library/proceedings/usenix98/levy.html}. - - - The Janus project provides a secure environment for untrusted helper - applications by trapping unsafe system calls. The project page is - \url{http://www.cs.berkeley.edu/~daw/janus/}. Thanks to Paul Prescod - for suggesting it. - - Can you suggest other links, or some academic references, for this section? \section{Version History} ! Sep. 12, 1998: Minor revisions and added the reference to the Janus project. Feb. 26, 1998: First version. Suggestions are welcome. --- 14,32 ---- \begin{abstract} \noindent ! Python provides a \module{rexec} module running untrusted code. ! However, it's never been exhaustively audited for security and it ! hasn't been updated to take into account recent changes to Python such ! as new-style classes. Therefore, the ! \module{rexec} module should not be trusted. To discourage use of ! \module{rexec}, this HOWTO has been withdrawn. \end{abstract} \section{Version History} ! Sep. 12, 1998: Minor revisions and added the reference to the Janus ! project. Feb. 26, 1998: First version. Suggestions are welcome. *************** *** 564,567 **** --- 37,42 ---- Oct. 4, 2000: Checked with Python 2.0. Minor rewrites and fixes made. Version number increased to 2.0. + + Dec. 17, 2002: Withdrawn. \end{document} |
From: A.M. K. <aku...@us...> - 2002-11-26 16:08:13
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv23454 Modified Files: curses.tex Log Message: Use American spelling of 'color', except in one place. Bump version number to 2.01 Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** curses.tex 26 Nov 2002 16:05:50 -0000 1.21 --- curses.tex 26 Nov 2002 16:08:10 -0000 1.22 *************** *** 3,7 **** \title{Curses Programming with Python} ! \release{2.0} \author{A.M. Kuchling \and\ Eric S. Raymond} --- 3,7 ---- \title{Curses Programming with Python} ! \release{2.01} \author{A.M. Kuchling \and\ Eric S. Raymond} *************** *** 267,271 **** Attributes allow displaying text in highlighted forms, such as in ! boldface, underline, reverse code, or in colour. They'll be explained in more detail in the next subsection. --- 267,271 ---- Attributes allow displaying text in highlighted forms, such as in ! boldface, underline, reverse code, or in color. They'll be explained in more detail in the next subsection. *************** *** 295,299 **** won't need to worry about leaving it in odd locations. ! \subsection{Attributes and Colour} Characters can be displayed in different ways. Status lines in a --- 295,299 ---- won't need to worry about leaving it in odd locations. ! \subsection{Attributes and Color} Characters can be displayed in different ways. Status lines in a *************** *** 328,353 **** \end{verbatim} ! The curses library also supports colour on those terminals that provide it, The most common such terminal is probably the Linux ! console, followed by colour xterms. ! To use colour, you must call the \function{start_color()} function soon after calling \function{initscr()}, to initialize the default ! colour set (the \function{curses.wrapper.wrapper()} function does this automatically). Once that's done, the \function{has_colors()} function returns TRUE if the terminal in use can actually display ! colour. (Note from amk: that curses uses the American spelling ! 'color', instead of the Canadian/British spelling 'colour'; if you're like me, you'll have to resign yourself to misspelling it for the sake of these functions.) ! The curses library maintains a finite number of colour pairs, ! containing a foreground (or text) colour and a background colour. You ! can get the attribute value corresponding to a colour pair with the \function{color_pair()} function; this can be bitwise-OR'ed with other attributes such as \constant{A_REVERSE}, but again, such combinations are not guaranteed to work on all terminals. ! An example, which displays a line of text using colour pair 1: \begin{verbatim} --- 328,353 ---- \end{verbatim} ! The curses library also supports color on those terminals that provide it, The most common such terminal is probably the Linux ! console, followed by color xterms. ! To use color, you must call the \function{start_color()} function soon after calling \function{initscr()}, to initialize the default ! color set (the \function{curses.wrapper.wrapper()} function does this automatically). Once that's done, the \function{has_colors()} function returns TRUE if the terminal in use can actually display ! color. (Note from AMK: curses uses the American spelling ! 'color', instead of the Canadian/British spelling 'colour'. If you're like me, you'll have to resign yourself to misspelling it for the sake of these functions.) ! The curses library maintains a finite number of color pairs, ! containing a foreground (or text) color and a background color. You ! can get the attribute value corresponding to a color pair with the \function{color_pair()} function; this can be bitwise-OR'ed with other attributes such as \constant{A_REVERSE}, but again, such combinations are not guaranteed to work on all terminals. ! An example, which displays a line of text using color pair 1: \begin{verbatim} *************** *** 356,373 **** \end{verbatim} ! As I said before, a colour pair consists of a foreground and ! background colour. \function{start_color()} initializes 8 basic ! colours when it activates colour mode. They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and 7:white. The curses ! module defines named constants for each of these colours: \constant{curses.COLOR_BLACK}, \constant{curses.COLOR_RED}, and so forth. The \function{init_pair(\var{n, f, b})} function changes the ! definition of colour pair \var{n}, to foreground colour {f} and ! background colour {b}. Colour pair 0 is hard-wired to white on black, and cannot be changed. ! Let's put all this together. To change colour 1 to red text on a white background, you would call: --- 356,373 ---- \end{verbatim} ! As I said before, a color pair consists of a foreground and ! background color. \function{start_color()} initializes 8 basic ! colors when it activates color mode. They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and 7:white. The curses ! module defines named constants for each of these colors: \constant{curses.COLOR_BLACK}, \constant{curses.COLOR_RED}, and so forth. The \function{init_pair(\var{n, f, b})} function changes the ! definition of color pair \var{n}, to foreground color {f} and ! background color {b}. Color pair 0 is hard-wired to white on black, and cannot be changed. ! Let's put all this together. To change color 1 to red text on a white background, you would call: *************** *** 376,382 **** \end{verbatim} ! When you change a colour pair, any text already displayed using that ! colour pair will change to the new colours. You can also display new ! text in this colour with: \begin{verbatim} --- 376,382 ---- \end{verbatim} ! When you change a color pair, any text already displayed using that ! color pair will change to the new colors. You can also display new ! text in this color with: \begin{verbatim} *************** *** 384,390 **** \end{verbatim} ! Very fancy terminals can change the definitions of the actual colours ! to a given RGB value. This lets you change colour 1, which is usually ! red, to purple or blue or any other colour you like. Unfortunately, the Linux console doesn't support this, so I'm unable to try it out, and can't provide any examples. You can check if your terminal can do --- 384,390 ---- \end{verbatim} ! Very fancy terminals can change the definitions of the actual colors ! to a given RGB value. This lets you change color 1, which is usually ! red, to purple or blue or any other color you like. Unfortunately, the Linux console doesn't support this, so I'm unable to try it out, and can't provide any examples. You can check if your terminal can do |
From: A.M. K. <aku...@us...> - 2002-11-26 16:05:53
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv22528 Modified Files: advocacy.tex curses.tex regex.tex rexec.tex Log Message: Update e-mail address Index: advocacy.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/advocacy.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** advocacy.tex 26 Nov 2002 16:02:15 -0000 1.10 --- advocacy.tex 26 Nov 2002 16:05:50 -0000 1.11 *************** *** 7,11 **** \author{A.M. Kuchling} ! \authoraddress{\email{aku...@me...}} \begin{document} --- 7,11 ---- \author{A.M. Kuchling} ! \authoraddress{\email{am...@am...}} \begin{document} Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** curses.tex 26 Nov 2002 16:02:15 -0000 1.20 --- curses.tex 26 Nov 2002 16:05:50 -0000 1.21 *************** *** 6,10 **** \author{A.M. Kuchling \and\ Eric S. Raymond} ! \authoraddress{\email{aku...@me...}, \email{es...@th...}} \begin{document} --- 6,10 ---- \author{A.M. Kuchling \and\ Eric S. Raymond} ! \authoraddress{\email{am...@am...}, \email{es...@th...}} \begin{document} Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** regex.tex 26 Nov 2002 16:02:15 -0000 1.12 --- regex.tex 26 Nov 2002 16:05:50 -0000 1.13 *************** *** 12,16 **** \author{A.M. Kuchling} ! \authoraddress{\email{aku...@me...}} \begin{document} --- 12,16 ---- \author{A.M. Kuchling} ! \authoraddress{\email{am...@am...}} \begin{document} Index: rexec.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/rexec.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** rexec.tex 26 Nov 2002 16:02:15 -0000 1.11 --- rexec.tex 26 Nov 2002 16:05:50 -0000 1.12 *************** *** 6,10 **** \author{A.M. Kuchling} ! \authoraddress{\email{aku...@me...}} \begin{document} --- 6,10 ---- \author{A.M. Kuchling} ! \authoraddress{\email{am...@am...}} \begin{document} |
From: A.M. K. <aku...@us...> - 2002-11-26 16:02:19
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv21096 Modified Files: advocacy.tex curses.tex regex.tex rexec.tex sockets.tex sorting.tex Log Message: Point link to python.org redirect Index: advocacy.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/advocacy.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** advocacy.tex 22 Jul 2002 12:22:10 -0000 1.9 --- advocacy.tex 26 Nov 2002 16:02:15 -0000 1.10 *************** *** 20,26 **** try to use Python. ! This document is available in several formats, including PostScript, ! PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} --- 20,25 ---- try to use Python. ! This document is available from the Python HOWTO page at ! \url{http://www.python.org/doc/howto}. \end{abstract} Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** curses.tex 18 Nov 2002 14:19:09 -0000 1.19 --- curses.tex 26 Nov 2002 16:02:15 -0000 1.20 *************** *** 15,18 **** --- 15,21 ---- This document describes how to write text-mode programs with Python 2.x, using the \module{curses} extension module to control the display. + + This document is available from the Python HOWTO page at + \url{http://www.python.org/doc/howto}. \end{abstract} Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** regex.tex 22 Jul 2002 12:16:21 -0000 1.11 --- regex.tex 26 Nov 2002 16:02:15 -0000 1.12 *************** *** 23,29 **** introduction than the corresponding section in the Library Reference. ! This document is available in several formats, including PostScript, ! PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} --- 23,28 ---- introduction than the corresponding section in the Library Reference. ! This document is available from the Python HOWTO page at ! \url{http://www.python.org/doc/howto}. \end{abstract} Index: rexec.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/rexec.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** rexec.tex 22 Jul 2002 12:16:21 -0000 1.10 --- rexec.tex 26 Nov 2002 16:02:15 -0000 1.11 *************** *** 21,27 **** Python Library Reference. ! This document is available in several formats, including PostScript, ! PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} --- 21,26 ---- Python Library Reference. ! This document is available from the Python HOWTO page at ! \url{http://www.python.org/doc/howto}. \end{abstract} Index: sockets.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/sockets.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** sockets.tex 22 Jul 2002 12:13:36 -0000 1.4 --- sockets.tex 26 Nov 2002 16:02:16 -0000 1.5 *************** *** 20,26 **** begin using them decently. ! This document is available in several formats, including PostScript, ! PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} --- 20,25 ---- begin using them decently. ! This document is available from the Python HOWTO page at ! \url{http://www.python.org/doc/howto}. \end{abstract} Index: sorting.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/sorting.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** sorting.tex 22 Jul 2002 12:16:21 -0000 1.5 --- sorting.tex 26 Nov 2002 16:02:16 -0000 1.6 *************** *** 19,25 **** \method{sort()} method. ! This document is available in several formats, including PostScript, ! PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} --- 19,24 ---- \method{sort()} method. ! This document is available from the Python HOWTO page at ! \url{http://www.python.org/doc/howto}. \end{abstract} |
From: A.M. K. <aku...@us...> - 2002-11-26 16:00:50
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv20506 Removed Files: ODBChints.tex Log Message: Delete old HOWTO |
From: A.M. K. <aku...@pr...> - 2002-11-18 14:19:14
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv32223 Modified Files: curses.tex Log Message: Mention version dependency; change case of section title Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** curses.tex 18 Nov 2002 14:15:01 -0000 1.18 --- curses.tex 18 Nov 2002 14:19:09 -0000 1.19 *************** *** 13,18 **** \begin{abstract} \noindent ! This document describes how to write text-mode programs with Python, ! using the curses extension module to control the display. \end{abstract} --- 13,18 ---- \begin{abstract} \noindent ! This document describes how to write text-mode programs with Python 2.x, ! using the \module{curses} extension module to control the display. \end{abstract} *************** *** 77,81 **** you the basic ideas. ! \section{Starting and ending a curses Application} Before doing anything, curses must be initialized. This is done by --- 77,81 ---- you the basic ideas. ! \section{Starting and ending a curses application} Before doing anything, curses must be initialized. This is done by |
From: A.M. K. <aku...@pr...> - 2002-11-18 14:15:25
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv29979 Modified Files: curses.tex Log Message: Use right function name Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** curses.tex 17 May 2002 20:24:52 -0000 1.17 --- curses.tex 18 Nov 2002 14:15:01 -0000 1.18 *************** *** 160,164 **** and so forth. ! The \code{stdscr} object returned by the \function{initwin()} function is a window object that covers the entire screen. Many programs may need only this single window, but you might wish to divide the screen --- 160,164 ---- and so forth. ! The \code{stdscr} object returned by the \function{initscr()} function is a window object that covers the entire screen. Many programs may need only this single window, but you might wish to divide the screen |
From: A.M. K. <aku...@us...> - 2002-09-11 22:09:18
|
Update of /cvsroot/py-howto/pyhowto/zodb In directory usw-pr-cvs1:/tmp/cvs-serv619 Removed Files: Makefile chatter.py gfdl.tex introduction.tex links.tex modules.tex prog-zodb.tex storages.tex transactions.tex zeo.tex zodb.tex Log Message: Remove old copy of ZODB guide |
From: A.M. K. <aku...@us...> - 2002-07-22 12:22:13
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv10646 Modified Files: advocacy.tex Log Message: pythonjournal.com seems inaccessible. (Wish they'd give up the domain name and let someone do something useful with it...) Index: advocacy.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/advocacy.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** advocacy.tex 22 Jul 2002 12:16:21 -0000 1.8 --- advocacy.tex 22 Jul 2002 12:22:10 -0000 1.9 *************** *** 366,374 **** \end{quotation} ! \term{\url{http://www.pythonjournal.com/volume1/art-interview/}} ! This interview with Andy Feit, discussing Infoseek's use of Python, can be ! used to show that choosing Python didn't introduce any difficulties ! into a company's development process, and provided some substantial benefits. \term{\url{http://www.python.org/psa/Commercial.html}} --- 366,374 ---- \end{quotation} ! %\term{\url{http://www.pythonjournal.com/volume1/art-interview/}} ! %This interview with Andy Feit, discussing Infoseek's use of Python, can be ! %used to show that choosing Python didn't introduce any difficulties ! %into a company's development process, and provided some substantial benefits. \term{\url{http://www.python.org/psa/Commercial.html}} |
From: A.M. K. <aku...@us...> - 2002-07-22 12:16:24
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv8188 Modified Files: ODBChints.tex advocacy.tex regex.tex rexec.tex sorting.tex Log Message: Fix URL Index: ODBChints.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/ODBChints.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** ODBChints.tex 23 Nov 2000 08:08:39 -0000 1.3 --- ODBChints.tex 22 Jul 2002 12:16:21 -0000 1.4 *************** *** 15,19 **** This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://www.python.org/doc/howto/}. \end{abstract} --- 15,19 ---- This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} Index: advocacy.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/advocacy.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** advocacy.tex 16 Jul 2002 19:30:07 -0000 1.7 --- advocacy.tex 22 Jul 2002 12:16:21 -0000 1.8 *************** *** 22,26 **** This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://www.python.org/doc/howto/}. \end{abstract} --- 22,26 ---- This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} Index: regex.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/regex.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** regex.tex 5 Nov 2001 21:25:42 -0000 1.10 --- regex.tex 22 Jul 2002 12:16:21 -0000 1.11 *************** *** 25,29 **** This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://www.python.org/doc/howto/}. \end{abstract} --- 25,29 ---- This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} Index: rexec.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/rexec.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** rexec.tex 5 Nov 2001 21:25:42 -0000 1.9 --- rexec.tex 22 Jul 2002 12:16:21 -0000 1.10 *************** *** 23,27 **** This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://www.python.org/doc/howto/}. \end{abstract} --- 23,27 ---- This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} Index: sorting.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/sorting.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** sorting.tex 9 Dec 1999 12:58:18 -0000 1.4 --- sorting.tex 22 Jul 2002 12:16:21 -0000 1.5 *************** *** 21,25 **** This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://www.python.org/doc/howto/}. \end{abstract} --- 21,25 ---- This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} |
From: A.M. K. <aku...@us...> - 2002-07-22 12:13:40
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv6858 Modified Files: sockets.tex Log Message: [Patch #584296 from Gerhard Häring] Fix 2-arg connect(), and a typo Update URL Index: sockets.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/sockets.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** sockets.tex 9 Dec 1999 12:58:18 -0000 1.3 --- sockets.tex 22 Jul 2002 12:13:36 -0000 1.4 *************** *** 22,26 **** This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://www.python.org/doc/howto/}. \end{abstract} --- 22,26 ---- This document is available in several formats, including PostScript, PDF, HTML and plain ASCII, from the Python HOWTO page at ! \url{http://py-howto.sf.net/}. \end{abstract} *************** *** 80,84 **** #now connect to the web server on port 80 # - the normal http port ! s.connect("www.mcmillan-inc.com", 80) \end{verbatim} --- 80,84 ---- #now connect to the web server on port 80 # - the normal http port ! s.connect(("www.mcmillan-inc.com", 80)) \end{verbatim} *************** *** 94,98 **** \begin{verbatim} #create an INET, STREAMing socket ! serverscket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) #bind the socket to a public host, --- 94,98 ---- \begin{verbatim} #create an INET, STREAMing socket ! serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) #bind the socket to a public host, |
From: A.M. K. <aku...@us...> - 2002-07-16 19:30:11
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv13904 Modified Files: advocacy.tex Log Message: Rename JPython -> Jython Fix typo Index: advocacy.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/advocacy.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** advocacy.tex 5 Nov 2001 21:25:41 -0000 1.6 --- advocacy.tex 16 Jul 2002 19:30:07 -0000 1.7 *************** *** 74,78 **** Lisp/Scheme, but in reality, Ousterhout's argument applies to scripting languages in general, since you could equally write ! extensions for any of the langauges mentioned above. \subsection{Prototyping} --- 74,78 ---- Lisp/Scheme, but in reality, Ousterhout's argument applies to scripting languages in general, since you could equally write ! extensions for any of the languages mentioned above. \subsection{Prototyping} *************** *** 213,223 **** \subsection{Java Integration} ! If you're working with Java, JPython ! (\url{http://www.python.org/jpython/}) is definitely worth your ! attention. JPython is a re-implementation of Python in Java that compiles Python code into Java bytecodes. The resulting environment has very tight, almost seamless, integration with Java. It's trivial to access Java classes from Python, and you can write Python classes ! that subclass Java classes. JPython can be used for prototyping Java applications in much the same way CPython is used, and it can also be used for test suites for Java code, or embedded in a Java application --- 213,223 ---- \subsection{Java Integration} ! If you're working with Java, Jython ! (\url{http://www.jython.org/}) is definitely worth your ! attention. Jython is a re-implementation of Python in Java that compiles Python code into Java bytecodes. The resulting environment has very tight, almost seamless, integration with Java. It's trivial to access Java classes from Python, and you can write Python classes ! that subclass Java classes. Jython can be used for prototyping Java applications in much the same way CPython is used, and it can also be used for test suites for Java code, or embedded in a Java application |
From: A.M. K. <aku...@us...> - 2002-05-17 20:24:55
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv4168 Modified Files: curses.tex Log Message: keypad() is a window method (noted by Mark Nenadov) Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** curses.tex 5 Nov 2001 21:25:42 -0000 1.16 --- curses.tex 17 May 2002 20:24:52 -0000 1.17 *************** *** 118,122 **** \begin{verbatim} ! curses.keypad(1) \end{verbatim} --- 118,122 ---- \begin{verbatim} ! stdscr.keypad(1) \end{verbatim} *************** *** 125,129 **** \begin{verbatim} ! curses.nocbreak(); curses.keypad(0); curses.echo() \end{verbatim} --- 125,129 ---- \begin{verbatim} ! curses.nocbreak(); stdscr.keypad(0); curses.echo() \end{verbatim} |
From: A.M. K. <aku...@us...> - 2002-04-18 14:32:11
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv30006 Modified Files: Makefile Removed Files: editor.tex Log Message: And then there were 8... delete one more HOWTO, whose content will now live at www.python.org/editors/ Index: Makefile =================================================================== RCS file: /cvsroot/py-howto/pyhowto/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Makefile 18 Apr 2002 02:22:50 -0000 1.7 --- Makefile 18 Apr 2002 14:21:00 -0000 1.8 *************** *** 6,10 **** # List of HOWTOs that aren't to be processed ! REMOVE_HOWTO = ODBChints.tex editor.tex # Determine list of files to be built --- 6,10 ---- # List of HOWTOs that aren't to be processed ! REMOVE_HOWTO = ODBChints.tex # Determine list of files to be built |
From: A.M. K. <aku...@us...> - 2002-04-18 02:22:53
|
Update of /cvsroot/py-howto/pyhowto In directory usw-pr-cvs1:/tmp/cvs-serv6638 Modified Files: Makefile Log Message: Remove last trace of deleted howto Index: Makefile =================================================================== RCS file: /cvsroot/py-howto/pyhowto/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Makefile 8 Jul 2001 01:41:44 -0000 1.6 --- Makefile 18 Apr 2002 02:22:50 -0000 1.7 *************** *** 6,10 **** # List of HOWTOs that aren't to be processed ! REMOVE_HOWTO = ODBChints.tex apachenote.tex # Determine list of files to be built --- 6,10 ---- # List of HOWTOs that aren't to be processed ! REMOVE_HOWTO = ODBChints.tex editor.tex # Determine list of files to be built |