Python Strinh Immutability Broken!

Hendrik van Rooyen mail at
Wed Aug 27 00:29:35 CEST 2008

"Gabriel Genellina":

>To avoid altering the equilibrium of the whole universe, use

Thanks Gabriel – looks like I really have to spend more time with that
excellent document.

Patrick Maupin:

>Whenever I do low-level stuff like this, I'm in one of two modes:
>Mode #1:  I'm using somebody else's C library and the overhead of
>doing so is small.
>Mode #2:  I need to code my own low-level stuff (for speed, IO access,

This seems to be where I am at.

>In mode 1, I try not to break out a compiler.  ctypes is great for
>this, and the results are "pure python" to the extent that you can
>give pure python to someone else with the same C library, and it will
>work.  No muss, no fuss, no makefile, no question that ctypes is
>awesome stuff.
>In mode 2, I have to break out a compiler.  I almost never do this
>without ALSO breaking out Pyrex.  Pyrex is also awesome stuff, and in
>Pyrex, you can easily create a (new) Python string for your results
>without having to worry about reference counting or any other really
>nasty low level interpreter details.  You can code a lot of stuff in
>pure Pyrex, and you can easily mix and match Pyrex and C.
>Pyrex and ctypes are both tools which let me connect to non-Python
>code without having to remember to handle Python interpreter internals
>correctly.  If I can get by with ctypes, I do, but if I actually have
>to code in something other than Python to get the job done, I bypass
>ctypes and go straight for Pyrex.

Don’t know anything about Pyrex except that it is not in the
standard library on Suse – will try to read up on it. Thanks.

Terry Reedy:


>Which essentially is the bytearray type of 3.0.

How does it differ from plain old array.array(b,”The quick brown fox”)?

- Hendrik

More information about the Python-list mailing list