A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-October/113790.html below:

[Python-Dev] RFC: Add a new builtin strarray type to Python?

[Python-Dev] RFC: Add a new builtin strarray type to Python? [Python-Dev] RFC: Add a new builtin strarray type to Python?Antoine Pitrou solipsis at pitrou.net
Sun Oct 2 15:25:21 CEST 2011
On Sun, 2 Oct 2011 15:00:01 +0200
Victor Stinner <victor.stinner at haypocalc.com> wrote:
> 
> > I don't understand why StringIO couldn't simply be optimized a little
> > more, if it needs to.
> 
> Honestly, I didn't know that StringIO.write() is more efficient than str+=str, 
> and it is surprising to use the io module (which is supposed to be related to 
> files) to manipulate strings.

StringIO is an in-memory file-like object, like in 2.x (where it lived
in the "cStringIO" module). I don't think it's a novel thing.

> The PEP 393 uses one memory block, you cannot resize a str object anymore.

I don't know why you're saying that. The concatenation optimization
worked in 2.x where the "str" type also used only one memory block. You
just have to check that the refcount is about to drop to zero.
Of course, resizing only works if the two unicode objects are of the
same "kind".

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4