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/2005-September/056020.html below:

[Python-Dev] String views

[Python-Dev] String viewsJosiah Carlson jcarlson at uci.edu
Fri Sep 2 05:55:05 CEST 2005
skip at pobox.com wrote:
>     >> I'm skeptical about performance as well, but not for that reason.  A
>     >> string object can have a referent field.  If not NULL, it refers to
>     >> another string object which is INCREFed in the usual way.  At string
>     >> deallocation, if the referent is not NULL, the referent is DECREFed.
>     >> If the referent is NULL, ob_sval is freed.
> 
>     Michael> Won't work. A string may have multiple referrents, so a single
>     Michael> referent field isn't sufficient.
> 
> Hmmm...  I implemented it last night (though it has yet to be tested).  I
> suspect it will work.  Here's my PyStringObject struct:


*cough* buffers with string methods *cough*  Seriously.  I know people
don't seem to like them much, but a buffer is a string view, an array
view, an mmap view, ...  It does /exactly/ what you suggest string views
should do, and it's already in Python.  With minor wrappers, one could
use string methods almost directly, or with modification of string
methods, buffers and strings could share methods.

 - Josiah

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