Commit Graph

146 Commits

Author SHA1 Message Date
Guido van Rossum e7b146fb3b The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:28:42 +00:00
Fred Drake e4f13660f8 split() docstring: Made signature and description for the first
parameter match.  Error pointed out by François
                    Pinard <pinard@iro.umontreal.ca> on c.l.py.
1999-11-04 19:19:48 +00:00
Barry Warsaw 226ae6ca12 Mainlining the string_methods branch. See branch revision log
messages for specific changes.
1999-10-12 19:54:53 +00:00
Guido van Rossum 1b7aec35c4 Fix PR#31 -- zfill() mishandles empty string. 1999-10-11 22:15:41 +00:00
Guido van Rossum 9a34523e19 As Tim Peters points out, ``from string import *'' should not set re to None.
Also rename safe_env to _safe_env.
1998-04-20 14:01:00 +00:00
Guido van Rossum a6bb6be95f Strip argument to atol and atof to match what strop does better. 1998-03-30 17:22:30 +00:00
Guido van Rossum 8ca842066c A few lines were indented using spaces instead of tabs -- fix them. 1998-03-26 20:56:10 +00:00
Guido van Rossum 23e21e7cf3 Minor editing corrections. 1997-12-29 19:57:36 +00:00
Guido van Rossum 2003204ba7 Added doc string, provided by Charles Waldman (with some reformatting
and a little editing my me).
1997-12-29 19:26:28 +00:00
Guido van Rossum d0753e20b2 At Barry's suggestion, plug the security leak by using an empty
__builtins__ for all calls to eval().  This still allows someone to
write string.atof("[1]*1000000") (which Jim Fulton worries about) but
effectively disables access to system modules and functions.
1997-12-10 22:59:55 +00:00
Guido van Rossum 90d62ab0a1 Since this module is used as a fallback in case no built-in modules
have been configured, string.atof() should not fail when "import re"
fails (usually because pcre is not there).

This opens up a tiny security hole: *if* an attacker can make "import
re" fail, they can also make string.atof(arbitrary_string) evaluate
the arbitrary string.  Nothing to keep me awake at night...
1997-12-10 22:35:02 +00:00
Guido van Rossum 06ba34c5d4 In string.split(), honor maxsplit (if > 0).
In string.splitfields(), ignore maxsplit if <= 0, rather than ignoring
maxsplit=0 but effectively treating negative numbers the same as
maxsplit=1.  Also made the test for maxsplit slightly more efficient
(set it to the length of the string when <= 0 so the test for its
presence can be omitted from the loop).
1997-12-01 15:25:19 +00:00
Guido van Rossum 9694fcab53 Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
Guido van Rossum 1510565cb5 Add optional 4th argument to count(), matching find() etc.
Also change all occurrences of "x == None" to "x is None" (not that it
matters much, these functions are all reimplemented in strop -- but
count() is not).
1997-10-20 23:31:15 +00:00
Guido van Rossum 21aa0ef351 Changed my mind on replace().
It's now replace(str, old, new, maxsplit=0).
Note new ordering of parameters (string first);
this is more consistent with translate().
1997-04-02 05:49:46 +00:00
Guido van Rossum 1eb9a81eb9 Added new functions replace() and replace1(). 1997-03-25 16:50:31 +00:00
Guido van Rossum 7b7c578616 Add optional 4th argument to [r]find and [r]index (end of slice). 1997-03-14 04:13:56 +00:00
Guido van Rossum f480c674b1 Use correct separator for capwords(s, sep). 1996-08-26 15:55:00 +00:00
Guido van Rossum 34f173110f Add optional separator character to capwords(), for completeness. 1996-08-20 20:25:41 +00:00
Guido van Rossum 306a8a6338 Add optional third parameter to split() and splitfields(), giving the
maximum number of delimiters to parse; e.g.
splitfields("a,b,c,d", ",", 2) -> ["a", "b", "c,d"].
1996-08-08 18:40:59 +00:00
Guido van Rossum ed7253ca50 Added 3rd optional argument to translate(), a string of characters to delete.
Added maketrans(), a utility to create a translation table.
1996-07-23 18:12:39 +00:00
Guido van Rossum 8775d8b9dc Added capitalize() and capwords(). 1996-06-11 18:43:00 +00:00
Guido van Rossum 2539528810 add translate() -- which was in strop per release 1.3 1996-05-28 23:08:45 +00:00
Guido van Rossum 894a7bb995 default tabsize to 8 1995-08-10 19:42:05 +00:00
Guido van Rossum 2ab19920fc make split and splitfields, join and joinfields synonyms 1995-06-22 18:58:00 +00:00
Guido van Rossum 8c1688e132 add dummy base to atoi/atol; careful about negative start indices in find/count 1995-03-14 17:43:02 +00:00
Guido van Rossum 710c352d05 * Lib/string.py: find/rfind is now the main implementation and
index/rindex is a wrapper that raises index_error (which is now
	always ValueError)
1994-08-17 13:16:11 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum e65cce5eec * string.py: added rindex(), rfind(); changed index() to interpret
negative start indices starting from the right.
* ftplib.py: debug() -> set_debuglevel(); change demo to use __init__().
* os.py: added execl, execlp, and execvp.
* lambda.py: removed (now that we have built-in map, reduce, bagof, lambda)
* test_b{1,2}.py, testall.out: added tests for bagof, lambda, map, reduce
* commands.py: use os, not posix
* test_grammar.py: make it easy to disable non-portable int overflow tests
* dis.py: don't abuse range()
1993-11-08 15:05:21 +00:00
Guido van Rossum e61fa0a1e4 * profile.py, pdb.py: added help() function
* builtin.py: b/w compat for builtin -> __builtin__ name change
* string.py: added atof() and atol() and corresponding exceptions
* test_types.py: added test for list sort with  user comparison function
1993-10-22 13:56:35 +00:00
Guido van Rossum 8e2ec56cbc * pdb.py: set 'privileged' property when evaluating expressions
* string.py: change whitespace to include \r, \v and \f.
  When importing strop succeeds, re-evaluate meaning of letters.
1993-07-29 09:37:38 +00:00
Guido van Rossum d316607732 * ftplib.py: added abort() command (sends oob data).
* Several modules: change "class C(): ..." to "class C: ...".
* flp.py: support for frozen forms.
* Added string.find() which is like index but returns -1 if not found
1993-05-24 14:16:22 +00:00
Guido van Rossum e7113b6b3d * Fix bug in tzparse.py for DST timezone
* Added whatis command to pdb.py
* new module GET.py (GL definitions from <gl/get.h>)
* rect.py: is_empty takes a rect as argument, not two points.
* Added tests for builtin round() [XXX not yet complete!]
1993-03-29 11:30:50 +00:00
Guido van Rossum 18fc5696c8 * mainloop.py: added facility for calling select(). Also added
embryonic facility for pseudo-modal dialogs.
* stdwinevents.py: added modifier masks for key/mouse events
* renamed exceptions in nntplib.py
* Changed string.join() to call string.joinfields() to profit of
  strop.joinfields()
1992-11-26 09:17:19 +00:00
Guido van Rossum c629d34c4f * change default line numbers for 'list' in pdb.py
* changed eval() into getattr() in cmd.py
* added dirname(), basename() and (dummy) normath() to macpath.py
* renamed nntp.py to nntplib.py
* Made string.index() compatible with strop.index()
* Make string.atoi('') raise string.atoi_error rather than ValueError
* Added dirname() and normpath() to posixpath.
1992-11-05 10:43:02 +00:00
Guido van Rossum 2db91358de Misc changes and new modules. whrandom is "objectified". SOCKET.py
is moved to the sgi subdirectory.
1992-10-18 17:09:59 +00:00
Guido van Rossum 7a461e5aaf New module regsub contains sub(), gsub() and split() as in nawk.
string.splitfields(s, '') now returns [s] as split() in nawk.
Added _exit to exported functions of os.
1992-09-20 21:41:09 +00:00
Guido van Rossum ae507a42a0 splitfields(s, '') is illegal 1992-08-19 16:49:58 +00:00
Guido van Rossum 2d4aa4f5d4 Removed *.libs (now in ./sgi);
added gettext() method to TextEdit.py;
fixed string.atoi() to ignore leading zeros.
1992-08-06 22:33:41 +00:00
Guido van Rossum 6ff2e90c51 Add function to expand tabs. 1992-03-27 15:13:31 +00:00
Guido van Rossum a61ff7b160 New implementation method for case conversion. 1992-01-14 18:31:29 +00:00
Guido van Rossum bdfcfccbe5 New == syntax 1992-01-01 19:35:13 +00:00
Guido van Rossum 333c2e02d0 A plus is also a sign! 1991-08-16 13:29:03 +00:00
Guido van Rossum fac38b7c40 Added join() and joinfields() functions.
Fixed center().
Rewrote ljust() and rjust().
1991-04-07 13:42:19 +00:00
Guido van Rossum 66a07c07a5 Fix bugf in index -- last char would not be checked. 1990-12-26 15:39:06 +00:00
Guido van Rossum c636014c43 Initial revision 1990-10-13 19:23:40 +00:00