[Numpy-discussion] Failing to understand vectorize behavior

David Huard david.huard at gmail.com
Wed Jan 9 09:41:24 EST 2008


Hi all,

I'm having trouble understanding the behavior of vectorize on the following
example:

>>> import string
>>> from numpy import vectorize

>>> vstrip = vectorize(string.strip)
>>> s = ['  aaaaaaaaaaaaaa  ' , ' bbbbbbbbbbbbbbbbbb  ', '
cccccccccccccccccc ']
>>> vstrip(s)
array(['aaaaaaaa', 'bbbbbbbb', 'cccccccc'],
      dtype='|S8')

where all strings are cropped to 8 characters.
Is this expected ?


Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080109/1ce413ba/attachment.html>


More information about the NumPy-Discussion mailing list