regex into str

Diez B. Roggisch deetsNOSPAM at web.de
Sun Aug 29 13:59:11 EDT 2004


Jeff Epler wrote:

> This is intended to be impossible.
> 
> Even if you could assign to str.__div__ (and this is very deliberately and
> specifically disallowed) you would end up disappointed, because strings
> are immutable.  That means there's nowhere to store "the last match",
> no way to mutate the string with the "/=" operator, and also that the
> interpreter is free to use the same storage for two equal strings.

Another reason for not allowing this is that modifying builtins can lead to
severe bugs, as other libs might rely on certain functionality. If you
change that, things start getting very weird....


-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list