Undefined behaviour in C [was Re: The Cost of Dynamism]

Chris Angelico rosuav at gmail.com
Sat Mar 26 08:03:06 EDT 2016


On Sat, Mar 26, 2016 at 9:39 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> It is an accident of history that Python's first and major implementation
> happens to be written in C. (Although its use as a glue language, allowing
> people to safely use libraries written in C, probably played a role in
> ensuring Python's success.)

Your parenthesis is more important than you may be giving it credit
for, so IMO C is more than "an accident of history" in Python's
success. There's a massive network effect surrounding programming
languages, particularly glue languages. Suppose I were to develop a
brand-new library of awesomeness, distributed as a Java .class file.
Python (via Jython) could now use that, but many MANY other languages
could not, ergo my library would languish. But if I design my library
to have C bindings instead, Java programs can't use it, but any
language that is able to connect to C code can. Conversely, if I'm
developing a new language, I can look at the available C libraries and
say "hey, look, access to C bindings gives me GUI toolkits, bignums,
etc, etc, etc", so it's worth my while to connect to that. C may
itself be immaterial, but the network surrounding it has been, and
continues to be. Thanks to CPython, Python can be easily compiled for
any CPU or OS that has the standard C build tools ported to it; that's
a huge dependency, but it's a dependency of *so* many other programs
that it's a high priority for OS developers.

Python's success comes partly through leveraging that portability and
power. The same could have been accomplished with any other language
at the center of the network, but the same wasn't accomplished with
any other language at the center of the network. It was done with C.

Of course, that doesn't mean that C's *behaviour* has anything to do
with Python's *behaviour*. That's a completely separate point.

ChrisA



More information about the Python-list mailing list