Why is array.array('u') deprecated?

jonathan.slenders at gmail.com jonathan.slenders at gmail.com
Fri May 8 08:12:00 EDT 2015


> Can you expand a bit on how array("u") helps here? Are the matches in the 
> gigabyte range?

I have a string of unicode characters, e.g.:

data = array.array('u', u'x' * 1000000000)

Then I need to change some data in the middle of this string, for instance:

data[500000] = 'y'

Then I want to use re to search in this text:

re.search('y', data)

This has to be fast. I really don't want to split and concatenate strings. Re should be able to process it and the expressions can be much more complex than this. (I think it should be anything that implements the buffer protocol).

So, this works perfectly fine and fast. But it scares me that it's deprecated and Python 4 will not support it anymore.



More information about the Python-list mailing list