Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> s = 'abc' >>> s.find ('b') 1 >>> s = 'aaa' >>> s.find ('a') 0 >>> s.find ('a', 1) 1 >>> s = 'aba' >>> s.find ('a', 1) 2 >>> from bad_get_indices import get_indices >>> get_indices ('abc', 'a') Traceback (most recent call last): File "", line 1, in File "bad_get_indices.py", line 8, in get_indices index = text.find(char, index) KeyboardInterrupt >>> get_indices ('ab', 'b') Traceback (most recent call last): File "", line 1, in File "bad_get_indices.py", line 7, in get_indices while text.find(char, index) != -1: KeyboardInterrupt >>> >>> get_indices ('abc', 'd') [] >>> from bad_again import get_indices >>> get_indices ('abc', 'd') [-1] >>> get_indices ('ab', 'b') [1, 1] >>> lst = [5,4,3,2,1] >>> m = lst.sort() >>> print m None >>> lst [1, 2, 3, 4, 5] >>> lst = [5,4,3,2,1] >>> m = sorted(lst) >>> m [1, 2, 3, 4, 5] >>> lst [5, 4, 3, 2, 1] >>> L = [4,3,2,1] >>> L2 = L >>> L2.sort() >>> L2 [1, 2, 3, 4] >>> L [1, 2, 3, 4] >>> 'abc'.find ('a', 99) -1