summaryrefslogtreecommitdiff
path: root/Lib/string.py
AgeCommit message (Collapse)AuthorLines
2002-01-30string.split() docstring described the interpretation of the maxsplitFred Drake-3/+3
argument incorrectly. This closes SF bug #505997.
2001-02-18removed __all__ from several modulesSkip Montanaro-6/+0
2001-02-15bunch more __all__ listsSkip Montanaro-0/+6
also modified check_all function to suppress all warnings since they aren't relevant to what this test is doing (allows quiet checking of regsub, for instance)
2001-02-09Nuke accurate but confusing and unhelpful comments about split vs splitfields.Tim Peters-1/+0
2001-02-09String method conversion.Eric S. Raymond-1/+1
2001-01-15Whitespace normalization.Tim Peters-1/+1
2000-12-19Make string.translate(s, table) work for Unicode s. Two things areGuido van Rossum-4/+11
required to work around restrictions on the arguments of u.translate(): 1) don't pass the deletions argument if it's empty; 2) convert table to Unicode if s is Unicode. This fixes SF bug #124060.
2000-09-18Fix serious typo!Fred Drake-1/+3
Add the new constants to the module docstring.
2000-09-18Richard Mortier <rmm1002@users.sourceforge.net>:Fred Drake-0/+2
Add the constants "printable" and "punctuation" to the string module.
2000-07-16Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters-1/+1
comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-03Martin von Löwis <martin@loewis.home.cs.tu-berlin.de>:Fred Drake-40/+9
This patch delegates more string functions to string object methods, uses the varargs delegation syntax, and stops using stringold. Closes SourceForge patch #100712.
2000-04-05Marc-Andre's third try at this bulk patch seems to work (except thatGuido van Rossum-33/+6
his copy of test_contains.py seems to be broken -- the lines he deleted were already absent). Checkin messages: New Unicode support for int(), float(), complex() and long(). - new APIs PyInt_FromUnicode() and PyLong_FromUnicode() - added support for Unicode to PyFloat_FromString() - new encoding API PyUnicode_EncodeDecimal() which converts Unicode to a decimal char* string (used in the above new APIs) - shortcuts for calls like int(<int object>) and float(<float obj>) - tests for all of the above Unicode compares and contains checks: - comparing Unicode and non-string types now works; TypeErrors are masked, all other errors such as ValueError during Unicode coercion are passed through (note that PyUnicode_Compare does not implement the masking -- PyObject_Compare does this) - contains now works for non-string types too; TypeErrors are masked and 0 returned; all other errors are passed through Better testing support for the standard codecs. Misc minor enhancements, such as an alias dbcs for the mbcs codec. Changes: - PyLong_FromString() now applies the same error checks as does PyInt_FromString(): trailing garbage is reported as error and not longer silently ignored. The only characters which may be trailing the digits are 'L' and 'l' -- these are still silently ignored. - string.ato?() now directly interface to int(), long() and float(). The error strings are now a little different, but the type still remains the same. These functions are now ready to get declared obsolete ;-) - PyNumber_Int() now also does a check for embedded NULL chars in the input string; PyNumber_Long() already did this (and still does) Followed by: Looks like I've gone a step too far there... (and test_contains.py seem to have a bug too). I've changed back to reporting all errors in PyUnicode_Contains() and added a few more test cases to test_contains.py (plus corrected the join() NameError).
2000-03-10Marc-Andre Lemburg: the maxsplit argument for split() and replace()Guido van Rossum-4/+4
now defaults to -1, not to 0. Passing an explicit zero doesn't split or replace at all.
2000-02-10Detabify.Fred Drake-28/+28
I ran "expand" instead of using Skip's patch, but it's all the same.
2000-02-04The third and final doc-string sweep by Ka-Ping Yee.Guido van Rossum-7/+5
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.
1999-11-04split() docstring: Made signature and description for the firstFred Drake-2/+2
parameter match. Error pointed out by François Pinard <pinard@iro.umontreal.ca> on c.l.py.
1999-10-12Mainlining the string_methods branch. See branch revision logBarry Warsaw-408/+253
messages for specific changes.
1999-10-11Fix PR#31 -- zfill() mishandles empty string.Guido van Rossum-1/+1
1998-04-20As Tim Peters points out, ``from string import *'' should not set re to None.Guido van Rossum-9/+11
Also rename safe_env to _safe_env.
1998-03-30Strip argument to atol and atof to match what strop does better.Guido van Rossum-2/+2
1998-03-26A few lines were indented using spaces instead of tabs -- fix them.Guido van Rossum-4/+5
1997-12-29Minor editing corrections.Guido van Rossum-13/+13
1997-12-29Added doc string, provided by Charles Waldman (with some reformattingGuido van Rossum-0/+223
and a little editing my me).
1997-12-10At Barry's suggestion, plug the security leak by using an emptyGuido van Rossum-3/+6
__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-10Since this module is used as a fallback in case no built-in modulesGuido van Rossum-3/+7
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-01In string.split(), honor maxsplit (if > 0).Guido van Rossum-2/+8
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-10-22Convert all remaining *simple* cases of regex usage to re usage.Guido van Rossum-3/+6
1997-10-20Add optional 4th argument to count(), matching find() etc.Guido van Rossum-7/+14
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-04-02Changed my mind on replace().Guido van Rossum-12/+2
It's now replace(str, old, new, maxsplit=0). Note new ordering of parameters (string first); this is more consistent with translate().
1997-03-25Added new functions replace() and replace1().Guido van Rossum-0/+15
1997-03-14Add optional 4th argument to [r]find and [r]index (end of slice).Guido van Rossum-10/+26
1996-08-26Use correct separator for capwords(s, sep).Guido van Rossum-1/+1
1996-08-20Add optional separator character to capwords(), for completeness.Guido van Rossum-2/+2
1996-08-08Add optional third parameter to split() and splitfields(), giving theGuido van Rossum-4/+22
maximum number of delimiters to parse; e.g. splitfields("a,b,c,d", ",", 2) -> ["a", "b", "c,d"].
1996-07-23Added 3rd optional argument to translate(), a string of characters to delete.Guido van Rossum-9/+23
Added maketrans(), a utility to create a translation table.
1996-06-11Added capitalize() and capwords().Guido van Rossum-0/+10
1996-05-28add translate() -- which was in strop per release 1.3Guido van Rossum-0/+8
1995-08-10default tabsize to 8Guido van Rossum-1/+1
1995-06-22make split and splitfields, join and joinfields synonymsGuido van Rossum-6/+8
1995-03-14add dummy base to atoi/atol; careful about negative start indices in find/countGuido van Rossum-5/+11
1994-08-17 * Lib/string.py: find/rfind is now the main implementation andGuido van Rossum-63/+41
index/rindex is a wrapper that raises index_error (which is now always ValueError)
1994-08-01Merge alpha100 branch back to main trunkGuido van Rossum-24/+51
1993-11-08* string.py: added rindex(), rfind(); changed index() to interpretGuido van Rossum-0/+27
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-10-22* profile.py, pdb.py: added help() functionGuido van Rossum-1/+33
* 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-07-29* pdb.py: set 'privileged' property when evaluating expressionsGuido van Rossum-1/+4
* string.py: change whitespace to include \r, \v and \f. When importing strop succeeds, re-evaluate meaning of letters.
1993-05-24* ftplib.py: added abort() command (sends oob data).Guido van Rossum-2/+9
* 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-03-29* Fix bug in tzparse.py for DST timezoneGuido van Rossum-1/+3
* 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!]
1992-11-26* mainloop.py: added facility for calling select(). Also addedGuido van Rossum-4/+1
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-05* change default line numbers for 'list' in pdb.pyGuido van Rossum-3/+11
* 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-10-18Misc changes and new modules. whrandom is "objectified". SOCKET.pyGuido van Rossum-0/+12
is moved to the sgi subdirectory.