[Python-3000] "string" views

Josiah Carlson jcarlson at uci.edu
Fri Sep 1 21:20:21 CEST 2006


Attached you will find a zip file containing the implementation of a
'stringview' object written against Python 2.3 and Pyrex 0.9.3 .  I
didn't implement center, decode, encode, ljust, rjust, splitlines, title,
translate, zfill, __[r]mod__, slicing with indices != 1, my optimization
for view.join(...) doesn't seem to work, and view.split('') is also not
implemented.

I'm stopping for right now because I'm a bit burnt out on this
particular project.  If it seems hacked together, it is because it is
hacked together.  Whenever possible it returns views.  It also will
generally take anything that supports the buffer protocol as an argument
where a string or view would have also made sense.

Please remember that this is just a proof-of-concept implementation; I
would imagine that an actual view object would likely need to be written
in pure C, and though I have tested each method by hand, there may be
bugs.

I have also included the output file "stringview.c" for those without a
working Pyrex installation, which should compile against Python 2.3
headers, and perhaps even 2.4 headers.


 - Josiah
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stringview.zip
Type: application/x-zip-compressed
Size: 27685 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-3000/attachments/20060901/46f8ee58/attachment-0001.bin 


More information about the Python-3000 mailing list