Why it is so dramatical?

Jay O'Connor joconnor at cybermesa.com
Sun Sep 1 23:47:08 EDT 2002

In article <mailman.1030962662.4274.python-list at python.org>, "Bo M.
Maryniuck" <b.maryniuk at forbis.lt> wrote:

> As you see, adding string to the string isn't a huge problem for Perl as
> for Python. What's "wrong" with Perl?

Because in Perl, a string is mutable, in Python, a string is immutable.
This causes a performance tradeoff for some operations.  Mutable strings
allow you to extend a string easily so Perl is very fast at that kind of
operation; immutable strings allow you to 'intern' the string for faster
dictionary lookup when using strings as keys in a dictionary, as an

Neither is better, there are just tradeoffs between mutable and immutable
strings which the designers of both Perl and Python took into account
when they decided which to use based on what the language is intended to
do.  As a result Perl is much faster at some kinds of operations than
Python, and vice-versa.

Jay O'Connor
joconnor at cybermesa.com

More information about the Python-list mailing list