Python's biggest compromises

Skip Montanaro skip at pobox.com
Thu Jul 31 14:47:50 EDT 2003


    Anthony> What to you think python largest compromises are?

    Anthony> The three that come to my mind are significant whitespace,
    Anthony> dynamic typing, and that it is interpreted - not compiled.
    Anthony> These three put python under fire and cause some large projects
    Anthony> to move off python or relegate it to prototyping.

Your message is sure to get the pot boiling.  I don't think of any of the
above as compromises.  They were all design decisions.  Considering the
whitespace issue, calling it a compromise suggests that Guido had to cave in
to some outside forces.  He couldn't decide between BEGIN/END or {/} as
block delimiters, so he chose significant whitespace.  It doesn't make
sense.  

    Anthony> What about immutable strings? I'm not sure I understand Guido's
    Anthony> preference for them.

Performance is one reason.  The Python interpreter creates a huge number of
strings at runtime.  Knowing exactly how long the string is going to be and
that it will not grow means that a single malloc can be used to allocate the
object header and the storage for the data.  If strings were mutable, the
structure of the string object storage would probably be much different and
you'd need at minimum two mallocs per string, one for the object header and
one for the data itself.

Skip






More information about the Python-list mailing list