The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

Jon Ribbens jon+usenet at unequivocal.co.uk
Tue Mar 22 11:07:26 EDT 2016


On 2016-03-22, Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Mar 23, 2016 at 12:46 AM, Jon Ribbens
><jon+usenet at unequivocal.co.uk> wrote:
>> On 2016-03-22, Chris Angelico <rosuav at gmail.com> wrote:
>>> The first step in any program is to write it in the very simplest way
>>> possible. That usually means ignoring all error handling. And yes,
>>> this is true in EVERY language - C, PHP, Pike, DeScribe Macro
>>> Language, you name it.
>>
>> I'm afraid I have to say I think this is absolutely terrible advice.
>> If you write code in a language that does not have exceptions (e.g. C)
>> and get it working with no error handling, the chances are
>> approximately 100% that it will stay that way and be shipped without
>> error handling, until that lack causes someone a major problem.
>
> There are languages in which it's inadvisable. But can you honestly
> say that you've never written a C program with even a single error
> check omitted, first time?

No, quite the opposite - having done it is how I know that what tends
to happen is that the error handling never gets added ;-)

> So yes, it does happen, a lot. The difference with languages like
> Python is that this actually *is* good advice in Python.

Indeed, this is why I think that exceptions are a vital part of
a high-level language (and why Java's mandatory exception-declarations
are an abomination).

> Due to a mistake in editing, the parentheses around the "true in
> EVERY language" sentence were lost, which would have made it clearer
> that this is in two distinct parts:
>
> 1) This IS what happens, whatever language you use
> 2) This is the right thing to do in Python, but not always elsewhere.
>
> My apologies for the confusion.

Ah yes with the clarification I now agree with you ;-)



More information about the Python-list mailing list