From 7380a837802b4630bdcef6e01cd5be32f92750ca Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 21 Jan 2014 02:22:02 +0200 Subject: str: Implement proper string (instead of byte string) indexing. Also, support negative indexes. --- tests/basics/string1.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/basics/string1.py') diff --git a/tests/basics/string1.py b/tests/basics/string1.py index 40e766b594..074b04ef8f 100644 --- a/tests/basics/string1.py +++ b/tests/basics/string1.py @@ -10,6 +10,17 @@ print('123' + "456") print('123' * 5) +print('abc'[1]) +print('abc'[-1]) +try: + 'abc'[100] +except IndexError: + print('caught') +try: + 'abc'[-4] +except IndexError: + print('caught2') + # iter print(list('str')) -- cgit v1.2.3