On Wed, Mar 23, 2016 at 12:46 AM, Jon Ribbens
<jon+use...@unequivocal.co.uk> wrote:
> On 2016-03-22, Chris Angelico <ros...@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? (The trivial case of having never written a
C program counts only because smart people leave C to other people.)
And PHP's strpos function is not an abomination because it's
impossible to distinguish FALSE from 0, but because *most* PHP
programs are written without the mandatory check for FALSE after every
strpos. So yes, it does happen, a lot. The difference with languages
like Python is that this actually *is* good advice in Python. 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.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to