''.startswith() and ''.endswith() instead of string slicing to check for prefixes or suffixes.
w
http://legacy.python.org/dev/peps/pep-0008/
Yes: if foo.startswith('bar'):
No: if foo[:3] == 'bar':
w
http://legacy.python.org/dev/peps/pep-0008/
Yes: if foo.startswith('bar'):
No: if foo[:3] == 'bar':