Slight change to the string methods recommendation; we mitigate the

recommendation if compatibility with pre-Python 2.0 is necessary.
This commit is contained in:
Barry Warsaw 2002-05-29 16:07:27 +00:00
parent c112da34f8
commit 842de4b458
1 changed files with 4 additions and 3 deletions

View File

@ -518,9 +518,10 @@ Programming Recommendations
class MessageError(Exception):
"""Base class for errors in the email package."""
- Avoid the use of the string module; instead use string methods.
These are always much faster and share the same API with unicode
strings.
- Use string methods instead of the string module unless
backward-compatibility with versions earlier than Python 2.0 is
important. String methods are always much faster and share the
same API with unicode strings.
- Avoid slicing strings when checking for prefixes or suffixes.
Use startswith() and endswith() instead, since they are faster,