Commit Graph

10 Commits

Author SHA1 Message Date
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