[Python-ideas] Experiment: Adding "re" to string objects.

Christian Heimes lists at cheimes.de
Wed Jul 22 01:54:11 CEST 2009


Sean Reifschneider wrote:
> The difference being that strings are immutable and lists are not, but I
> don't see a particular concern with string.re being mutable, while still
> keeping strings immutable.  If you call a function with side-effects, it's
> going to result in side-effects.  That's the nature of the beast, and just
> a part of programming.

String objects may be used by and shared between multiple
subinterpreters. In order to keep the subinterpreters apart no shared
object must be mutable.
Strings and dicts are fundamental building blocks of the CPython
interpreter. If you chance any of the bricks you are changing the
foundation of the interpreter. You may open a can of worms much faster
than you might think.

I'm definitely -10 on any proposal that chances the PyStringObject
struct for regular expressions.

Christian




More information about the Python-ideas mailing list