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:
parent
c112da34f8
commit
842de4b458
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue