[Numpy-discussion] chararray behavior
Tue Jul 8 14:30:16 CDT 2008
2008/7/8 Alan McIntyre <email@example.com>:
> On Tue, Jul 8, 2008 at 1:29 PM, Travis E. Oliphant
> <firstname.lastname@example.org> wrote:
>> Alan McIntyre wrote:
>>> 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.
> That's what I would have expected, but for N >= 4, Q*N is the same as Q*4.
In particular, the returned type is always "string of length four",
which is very peculiar - why four? I realize that variable-length
strings are a problem (object arrays, I guess?), as is returning
arrays of varying dtypes (strings of length N), but this definitely
violates the principle of least surprise...
More information about the Numpy-discussion