Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53210 > unrolled thread

Re: Interface and duck typing woes

Started byChris Angelico <rosuav@gmail.com>
First post2013-08-29 11:39 +1000
Last post2013-08-29 02:48 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Interface and duck typing woes Chris Angelico <rosuav@gmail.com> - 2013-08-29 11:39 +1000
    Re: Interface and duck typing woes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-29 02:48 +0000

#53210 — Re: Interface and duck typing woes

FromChris Angelico <rosuav@gmail.com>
Date2013-08-29 11:39 +1000
SubjectRe: Interface and duck typing woes
Message-ID<mailman.343.1377740373.19984.python-list@python.org>
On Thu, Aug 29, 2013 at 11:20 AM, Cameron Simpson <cs@zip.com.au> wrote:
> However, when working in Java its type strictness caught a great
> many simple brainfart logic errors by checking function signatures;
> typically calling the wrong function/method or mangling arguments.
> Getting this stuff up front was handy.

It certainly is useful, which is why I like a language with declared
types. But it's not everything, and it's certainly far from
sufficient. So once you've decided that run-time errors are normal,
you write code with that in mind (in a web server, for instance, you'd
have some code around the outside that catches and logs errors and
returns a 500 to the client), and then you don't stress about them.
Any you can catch early, do so, but don't put more effort into
catching errors early than you save by not having them later.

The novice thinks his primary job is to stop the program from
crashing. The expert knows that a crash is just another way for things
to go wrong, and one of the easiest to deal with.

ChrisA

[toc] | [next] | [standalone]


#53211

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-08-29 02:48 +0000
Message-ID<521eb679$0$6599$c3e8da3$5496439d@news.astraweb.com>
In reply to#53210
On Thu, 29 Aug 2013 11:39:25 +1000, Chris Angelico wrote:

> The novice thinks his primary job is to stop the program from crashing.
> The expert knows that a crash is just another way for things to go
> wrong, and one of the easiest to deal with.

"I find it amusing when novice programmers believe their main job is 
preventing programs from crashing. ... More experienced programmers 
realize that correct code is great, code that crashes could use 
improvement, but incorrect code that doesn’t crash is a horrible 
nightmare."

http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/

Anyone who hasn't already done so, you should read the whole article. 
It's about static versus dynamic typing, testing, proving correctness, 
and how they all fit in together.


-- 
Steven

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web