# HG changeset patch # User paulb@localhost.localdomain # Date 1182708181 -7200 # Node ID 4e91a493eee2106f75844cf8bc08c0ebc918821e # Parent ea1d6c6f220fd23f7967e879aadecd3ab7646a59 Added string item and slice access. Tidied up list initialisation. Added the sys module. diff -r ea1d6c6f220f -r 4e91a493eee2 lib/builtins.py --- a/lib/builtins.py Sun Jun 24 03:21:23 2007 +0200 +++ b/lib/builtins.py Sun Jun 24 20:03:01 2007 +0200 @@ -474,10 +474,9 @@ return self != 0 class list: - def __init__(self, args=None): - if args is not None: - for arg in args: - self.append(arg) + def __init__(self, args=()): + for arg in args: + self.append(arg) def __getitem__(self, index): if -len(self) <= index < len(self): @@ -776,6 +775,15 @@ def __init__(self, x=None): x.__str__() + def __getitem__(self, index): + if -len(self) <= index < len(self): + return str() + else: + raise IndexError, index + + def __getslice__(self, start, end=None): + return str() + def __iadd__(self, other): if isinstance(other, str): return str() diff -r ea1d6c6f220f -r 4e91a493eee2 lib/sys.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/sys.py Sun Jun 24 20:03:01 2007 +0200 @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +argv = ["python"] + +def setrecursionlimit(n): + pass + +# vim: tabstop=4 expandtab shiftwidth=4