Commit Graph

33 Commits

Author SHA1 Message Date
Brett Cannon abb34fe9f3 UserString.MutableString has been removed in Python 3.0.
Works on issue #2877. Thanks Quentin Gallet-Gilles for the patch.
2008-05-29 05:08:50 +00:00
Raymond Hettinger 36316e37d5 No need to register subclass of ABCs. 2008-02-14 19:30:30 +00:00
Raymond Hettinger 31f6bc018b No need to register classes that already inherit from ABCs. 2008-02-11 18:51:08 +00:00
Raymond Hettinger 882a416900 Merge r60628, r60631, and r60633. Register UserList and UserString will the appropriate ABCs. 2008-02-07 03:25:46 +00:00
Thomas Wouters 3ccec68a05 Improve extended slicing support in builtin types and classes. Specifically:
- Specialcase extended slices that amount to a shallow copy the same way as
   is done for simple slices, in the tuple, string and unicode case.

 - Specialcase step-1 extended slices to optimize the common case for all
   involved types.

 - For lists, allow extended slice assignment of differing lengths as long
   as the step is 1. (Previously, 'l[:2:1] = []' failed even though
   'l[:2] = []' and 'l[:2:None] = []' do not.)

 - Implement extended slicing for buffer, array, structseq, mmap and
   UserString.UserString.

 - Implement slice-object support (but not non-step-1 slice assignment) for
   UserString.MutableString.

 - Add tests for all new functionality.
2007-08-28 15:28:19 +00:00
Neal Norwitz 418b97eac1 Cleanup: Remove import of types to get StringTypes, we can just use basestring. 2006-06-12 02:07:24 +00:00
Fredrik Lundh a26de2a80f added rpartition method to UserString class 2006-05-26 19:23:21 +00:00
Georg Brandl a172c32c05 Add "partition" to UserString. 2006-05-26 11:26:11 +00:00
Tim Peters eba28bea9b Whitespace normalization. 2005-03-28 01:08:02 +00:00
Walter Dörwald af3b39a182 Add support for negative indices in UserString.MutableString.__setitem__
and UserString.MutableString.__delitem__.
2005-02-18 13:22:43 +00:00
Hye-Shik Chang 4189c643f8 Remove .width() and .iswide() from UserString as well. 2004-08-04 08:01:06 +00:00
Hye-Shik Chang 6838c557fa Add comments for unicode-only methods to give hints on AttributeError
tracebacks. (Suggested by Walter Dörwald)
2004-06-04 04:23:29 +00:00
Hye-Shik Chang 5f5125997b Add iswide() and width() method for UserString according as the
addition to unicode objects.
2004-06-04 03:18:12 +00:00
Hye-Shik Chang eebb641f23 Add rsplit method for UserString, too.
(Spotted by Raymond Hettinger)
2003-12-15 19:46:09 +00:00
Raymond Hettinger 4f8f976576 Add optional fillchar argument to ljust(), rjust(), and center() string methods. 2003-11-26 08:21:35 +00:00
Thomas Heller 611dbc338e Remove a typo. (Or is this some markup I don't understand? ;-) 2003-08-27 10:48:12 +00:00
Neal Norwitz ffe33b7f24 Attempt to make all the various string *strip methods the same.
* Doc - add doc for when functions were added
 * UserString
 * string object methods
 * string module functions
'chars' is used for the last parameter everywhere.

These changes will be backported, since part of the changes
have already been made, but they were inconsistent.
2003-04-10 22:35:32 +00:00
Neil Schemenauer fe4f769fb8 Add __mod__ method to UserString. 2002-11-18 16:12:54 +00:00
Raymond Hettinger c35491ee3a Moved inplace add and multiply methods from UserString to MutableString.
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
2002-08-09 01:37:06 +00:00
Barry Warsaw 408b6d34de Complete the absolute import patch for the test suite. All relative
imports of test modules now import from the test package.  Other
related oddities are also fixed (like DeprecationWarning filters that
weren't specifying the full import part, etc.).  Also did a general
code cleanup to remove all "from test.test_support import *"'s.  Other
from...import *'s weren't changed.
2002-07-30 23:27:12 +00:00
Michael W. Hudson f207277167 More --disable-unicode stuff.
I'm getting better at vi!
2002-05-20 14:48:16 +00:00
Walter Dörwald 068325ef92 Apply the second version of SF patch http://www.python.org/sf/536241
Add a method zfill to str, unicode and UserString and change
Lib/string.py accordingly.

This activates the zfill version in unicodeobject.c that was
commented out and implements the same in stringobject.c. It also
adds the test for unicode support in Lib/string.py back in and
uses repr() instead() of str() (as it was before Lib/string.py 1.62)
2002-04-15 13:36:47 +00:00
Guido van Rossum 018b0eb0f5 Partially implement SF feature request 444708.
Add optional arg to string methods strip(), lstrip(), rstrip().
The optional arg specifies characters to delete.

Also for UserString.

Still to do:

- Misc/NEWS
- LaTeX docs (I did the docstrings though)
- Unicode methods, and Unicode support in the string methods.
2002-04-13 00:56:08 +00:00
Marc-André Lemburg 2d9204199f This patch changes the way the string .encode() method works slightly
and introduces a new method .decode().

The major change is that strg.encode() will no longer try to convert
Unicode returns from the codec into a string, but instead pass along
the Unicode object as-is. The same is now true for all other codec
return types. The underlying C APIs were changed accordingly.

Note that even though this does have the potential of breaking
existing code, the chances are low since conversion from Unicode
previously took place using the default encoding which is normally
set to ASCII rendering this auto-conversion mechanism useless for
most Unicode encodings.

The good news is that you can now use .encode() and .decode() with
much greater ease and that the door was opened for better accessibility
of the builtin codecs.

As demonstration of the new feature, the patch includes a few new
codecs which allow string to string encoding and decoding (rot13,
hex, zip, uu, base64).

Written by Marc-Andre Lemburg. Copyright assigned to the PSF.
2001-05-15 12:00:02 +00:00
Skip Montanaro e99d5ea25b added __all__ lists to a number of Python modules
added test script and expected output file as well
this closes patch 103297.
__all__ attributes will be added to other modules without first submitting
a patch, just adding the necessary line to the test script to verify
more-or-less correct implementation.
2001-01-20 19:54:20 +00:00
Tim Peters e119006e7d Whitespace normalization. Top level of Lib now fixed-point for reindent.py! 2001-01-15 03:34:38 +00:00
Guido van Rossum add8d86325 Fix two typos in __imul__. Closes Bug #117745. 2000-10-25 21:58:20 +00:00
Peter Schneider-Kamp fa12e13ae7 simple typo that makes regression test test_userstring fail 2000-08-24 21:47:34 +00:00
Thomas Wouters 104a7bcc28 Support for augmented assignment in the UserList, UserDict, UserString and
rfc822 (Addresslist) modules. Also a preliminary testcase for augmented
assignment, which should actually be merged with the test_class testcase I
added last week.
2000-08-24 20:14:10 +00:00
Fred Drake a893957c8e Denis S. Otkidach <den@analyt.chem.msu.ru>:
Let UserString.translate() method work with unicode data.

This closes SourceForge patch #101246.
2000-08-21 21:47:20 +00:00
Jeremy Hylton fd54757336 add isalpha and isalnum methods 2000-07-10 17:07:17 +00:00
Guido van Rossum 86662914be Marc-Andre Lemburg:
The maxsplit functionality in .splitlines() was replaced by the keepends
functionality which allows keeping the line end markers together
with the string.
2000-04-11 15:38:46 +00:00
Fred Drake a22b576d05 UserString class from Peter Funk <pf@artcom-gmbh.de>. 2000-04-03 03:51:50 +00:00