Re: [Tutor] Subclassing list

2009-06-18 Thread Kent Johnson
On Thu, Jun 18, 2009 at 9:48 PM, Luis N wrote: >>> I get an error "TypeError: 'rounding' is an invalid keyword argument >>> for this function" on my list subclass. >>> >>> How might I subclass list without this error? >>> >>> This is the code: >>> >>> class SeriesList(list): >>>    def __new__(cls

Re: [Tutor] Subclassing list

2009-06-18 Thread Luis N
On Fri, Jun 19, 2009 at 12:56 AM, bob gailer wrote: > > Luis N wrote: >> >> I get an error "TypeError: 'rounding' is an invalid keyword argument >> for this function" on my list subclass. >> >> How might I subclass list without this error? >> >> This is the code: >> >> class SeriesList(list): >>  

Re: [Tutor] Subclassing list

2009-06-18 Thread bob gailer
Luis N wrote: I get an error "TypeError: 'rounding' is an invalid keyword argument for this function" on my list subclass. How might I subclass list without this error? This is the code: class SeriesList(list): def __new__(cls, *args, **kwargs): series_list = list.__new__(cls, *arg

[Tutor] Subclassing list

2009-06-18 Thread Luis N
I get an error "TypeError: 'rounding' is an invalid keyword argument for this function" on my list subclass. How might I subclass list without this error? This is the code: class SeriesList(list): def __new__(cls, *args, **kwargs): series_list = list.__new__(cls, *args) serie

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Danny Yoo
> > > I'm trying to figure out how to subclass the list built-in. > > > You could do it e.g. like that: > > > > class Mylist (list): > > def __init__(self, seq=None): > > super(self.__class__, self).__init__(seq) > > def __getslice__(self, start, stop): > > return self.__cl

[Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Lloyd Kvam
> Message: 2 > Date: Tue, 22 Feb 2005 13:53:44 +0100 > From: [EMAIL PROTECTED] (Karl Pfl?sterer ) > Subject: Re: [Tutor] subclassing list -- slicing doesn't preserve type > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; char

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Brian van den Broek
Karl Pflästerer said unto the world upon 2005-02-22 07:53: On 22 Feb 2005, [EMAIL PROTECTED] wrote: I'm trying to figure out how to subclass the list built-in. .>>> class my_list(list): def __init__(self, sequence=None): list.__init__(self, sequence) self.spam = 1

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Kent Johnson
Brian van den Broek wrote: Hi all, I'm trying to figure out how to subclass the list built-in. .>>> class my_list(list): def __init__(self, sequence=None): list.__init__(self, sequence) self.spam = 1 .>>> mine = my_list((1,2,3,4)) .>>> mine.append(42) .>>>

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Karl =?iso-8859-1?Q?Pfl=E4sterer?=
On 22 Feb 2005, [EMAIL PROTECTED] wrote: > I'm trying to figure out how to subclass the list built-in. > > .>>> class my_list(list): > def __init__(self, sequence=None): > list.__init__(self, sequence) > self.spam = 1 > > .>>> mine = my_list((1,2,3

[Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Brian van den Broek
Hi all, I'm trying to figure out how to subclass the list built-in. .>>> class my_list(list): def __init__(self, sequence=None): list.__init__(self, sequence) self.spam = 1 .>>> mine = my_list((1,2,3,4)) .>>> mine.append(42) .>>> mine [1, 2, 3, 4,