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

Christian Heimes lists at cheimes.de
Sat Jul 18 16:30:19 CEST 2009


Nick Coghlan wrote:
> The idea of adding a mutable attribute to strings (even if it plays no
> part in string equality) sends shivers down my spine. It also seems like
> it would be difficult to do this in a way that didn't increase the size
> of all strings by at least one pointer slot.

I've more arguments against the re idea:

* regular expressions are rarely used in Python. I have just a couple of
scripts that use re

* we shouldn't encourage people in using re when there is a simpler
solution. Python isn't Perl.

* Several modules and a C extension must be loaded during *every*
interpreter startup. Everybody must pay the speed penalty and the memory
usage of the interpreter increases with every module, too. Lazy loading
may be a workaround, though

* Beautiful is better than ugly.

* Explicit is better than implicit.

* Simple is better than complex.

* Readability counts.


Christian




More information about the Python-ideas mailing list