Re: __iadd__ for a subclass of array - howto

2013-08-05 Thread Ian Kelly
On Mon, Aug 5, 2013 at 1:34 AM, Helmut Jarausch wrote: > Hi, > > I'd like to subclass array.array and implement operators like __iadd__ > How can this be accomplished. > > I'tried > > from array import array > > class Vec(array) : > def __new__(cls,Vinit) : > return array.__new__(cls,'d',Vin

__iadd__ for a subclass of array - howto

2013-08-05 Thread Helmut Jarausch
Hi, I'd like to subclass array.array and implement operators like __iadd__ How can this be accomplished. I'tried from array import array class Vec(array) : def __new__(cls,Vinit) : return array.__new__(cls,'d',Vinit) def __init__(self,*args) : self.N = len(self) def __str__(self