[Tutor] What I do wrong

Martijn Arts arts.martijn at gmail.com
Sun Dec 13 12:51:03 CET 2009


What doesn't work, does it have errors, etc.!

On Sun, Dec 13, 2009 at 12:25 PM, Grigor Kolev <grigor.kolev at gmail.com>wrote:

> class MyList ():
>        def __init__(self, value):
>                self.value = []
>                for x in value:
>                        self.value.append(x)
>        def __add__(self , other):
>                return MyList(self.value+other)
>        def __mul__(self , other):
>                return MyList(self.value*other)
>        def __getitem__(self , item):
>                return MyList(self.value+item)
>        def __len__(self ):
>                return len(self.value)
>        def __getlice__(self , low, high):
>                return MyList(self.value[low:high]
>        def append(self , other):
>                self.list=self.list.append(other)
>                return self.list
>        def __getattr__(self , name):
>                return getattr(self.value, name)
>        def __repr__(self  ):
>                return 'self.value'
> --
> Grigor Kolev <grigor.kolev at gmail.com>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091213/b5069232/attachment.htm>


More information about the Tutor mailing list