Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90148
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: Why is array.array('u') deprecated? |
| Date | 2015-05-08 13:35 +0200 |
| Organization | None |
| References | <80167ebf-c5ee-4699-89ca-ef544fe3decc@googlegroups.com> <554c8ff2$0$12990$c3e8da3$5496439d@news.astraweb.com> <93aaa9cd-5d30-44db-9324-4fffe292e9e4@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.237.1431084939.12865.python-list@python.org> (permalink) |
jonathan.slenders@gmail.com wrote:
> Le vendredi 8 mai 2015 12:29:15 UTC+2, Steven D'Aprano a écrit :
>> On Fri, 8 May 2015 07:14 pm, jonathan.slenders wrote:
>>
>> > Why is array.array('u') deprecated?
>> >
>> > Will we get an alternative for a character array or mutable unicode
>> > string?
>>
>>
>> Good question.
>>
>> Of the three main encodings for Unicode, two are variable-width:
>>
>> * UTF-8 uses 1-4 bytes per character
>> * UTF-16 uses 2 or 4 bytes per character
>>
>> while UTF-32 is fixed-width (4 bytes per character). So you could try
>> faking it with a 32-bit array and filling it with
>> string.encode('utf-32').
>
>
> I guess that doesn't work. I need to have something that I can pass to the
> re module for searching through it. Creating new strings all the time is
> no option. (Think about gigabyte strings.)
Can you expand a bit on how array("u") helps here? Are the matches in the
gigabyte range?
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why is array.array('u') deprecated? jonathan.slenders@gmail.com - 2015-05-08 02:14 -0700
Re: Why is array.array('u') deprecated? wxjmfauth@gmail.com - 2015-05-08 02:37 -0700
Re: Why is array.array('u') deprecated? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-08 20:29 +1000
Re: Why is array.array('u') deprecated? jonathan.slenders@gmail.com - 2015-05-08 04:05 -0700
Re: Why is array.array('u') deprecated? Peter Otten <__peter__@web.de> - 2015-05-08 13:35 +0200
Re: Why is array.array('u') deprecated? jonathan.slenders@gmail.com - 2015-05-08 05:12 -0700
Re: Why is array.array('u') deprecated? Peter Otten <__peter__@web.de> - 2015-05-08 15:11 +0200
Re: Why is array.array('u') deprecated? jonathan.slenders@gmail.com - 2015-05-08 07:40 -0700
Re: Why is array.array('u') deprecated? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-11 08:03 +0100
csiph-web