[Numpy-discussion] chararray behavior

Travis E. Oliphant oliphant@enthought....
Tue Jul 8 12:29:25 CDT 2008


Alan McIntyre wrote:
> Since chararray doesn't currently have any tests, I'm writing some,
> and I ran across a couple of things that didn't make sense to me:
>
> 1. The code for __mul__ is exactly the same as that for __rmul__; is
> there any reason __rmul__ shouldn't just call __mul__?
>   
Just additional function call overhead, but it's probably fine to just 
call __mul__.

> 1.5. __radd__ seems like it doesn't do anything fundamentally
> different from __add__, is there a reason to have a separate
> implementation of __radd__?
>   
Possibly.   I'm not sure.

> 2. The behavior of __mul__ seems odd:
>   
What is odd about this?

It is patterned after

 >>> 'a' * 3
 >>> 'a' * 4
 >>> 'a' * 5

for regular python strings.



-Travis



More information about the Numpy-discussion mailing list