Typing system vs. Java

David M. Cooke cookedm+news at physics.mcmaster.ca
Thu Aug 2 09:19:52 EDT 2001


At some point, "Terry Reedy" <tjreedy at home.com> wrote:

> "Donn Cave" <donn at u.washington.edu> wrote in message
> news:9ka118$mj8$1 at nntp6.u.washington.edu...
> > And the run time error is a TypeError: unsubscriptable object.
> > He's baffled enough by this to post to comp.lang.python instead
> > of figure it out himself.
> 
> What we need here are better error messages: a more explicit 'none
> object is not subscriptable' might have steered him to the problem.

Or perhaps better, a compile-time error that 'parse' has an implicit
'return None' at the end. Of course, adding that would mean that this:

def three_plus_1_problem(n):
    while 1:
       if n == 1: 
          return 1
       if x % 2 == 0:
          n = n / 2
       else:
          n = 3*n + 1

would also be an error; you'd have to throw an extraneous return at
the end. Personally, I could live with that for the extra sanity checking.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list