Python was designed (was Re: Multi-threading in Python vs Java)

John Nagle nagle at animats.com
Mon Oct 14 15:18:59 EDT 2013


On 10/12/2013 3:37 PM, Chris Angelico wrote:
> On Sat, Oct 12, 2013 at 7:10 AM, Peter Cacioppi 
> <peter.cacioppi at gmail.com> wrote:
>> Along with "batteries included" and "we're all adults", I think
>> Python needs a pithy phrase summarizing how well thought out it is.
>> That is to say, the major design decisions were all carefully
>> considered, and as a result things that might appear to be
>> problematic are actually not barriers in practice. My suggestion
>> for this phrase is "Guido was here".
> 
> "Designed".
> 
> You simply can't get a good clean design if you just let it grow by 
> itself, one feature at a time.

    No, Python went through the usual design screwups.  Look at how
painful the slow transition to Unicode was, from just "str" to
Unicode strings, ASCII strings, byte strings, byte arrays,
16 and 31 bit character builds, and finally automatic switching
between rune widths. Old-style classes vs. new-style classes.  Adding a
boolean type as an afterthought (that was avoidable; C went through
that painful transition before Python was created).    Operator "+"
as concatenation for built-in arrays but addition for NumPy
arrays.

    Each of those reflects a design error in the type system which
had to be corrected.

    The type system is now in good shape. The next step is to
make Python fast.  Python objects have dynamic operations suited
to a naive interpreter like CPython.  These make many compile
time optimizations hard. At any time, any thread can monkey-patch
any code, object, or variable in any other thread.  The ability
for anything to use "setattr()" on anything carries a high
performance price.  That's part of why Unladen Swallow failed
and why PyPy development is so slow.

				John Nagle



More information about the Python-list mailing list