[Types-sig] Type checks

skaller skaller@maxtal.com.au
Thu, 30 Dec 1999 10:51:24 +1100


Greg Stein wrote:
> 
> On Thu, 30 Dec 1999, skaller wrote:
> > Greg Stein wrote:
> > > Python is also very deterministic. "Implementation-defined" really does
> > > not exist.
> >
> >       I agree, more or less. There is some indeterminism with
> > bitwise operators (depends on the underlying C implementation,
> > which sucks :-)
> 
> If this is the case, then let Guido know. He has generally taken the pain
> to ensure that cases like this just don't exist.

	I agree. [I gave up 'advising' Guido on most things some time ago]
There's more 'indeterminism' or 'unspecified behaviour' in Python than
you might think -- although it is hard to say, since the specification
is not itself entirely precise, being worded somewhat informally.
 
> > > Errors in Python raise exceptions. That is how it is defined, and that is
> > > the general style/pattern for the language.
> >
> >       Not true for assertions.
> > And type constraints are assertions.
> 
> Stop being a nit-pick. 

	Why? Programs are executed by deterministic electro-mechanical
automata. They picky. Worse, language specifications describe
formal systems, which are also sensitive to nits. :-)

>But since you are, let me rephrase:
> 
> [In general,] errors in Python raise exceptions. [This is the pattern used
> for all errors. One error, AssertionError, as raised by the "assert"
> statement will not be raised by the compiler in "debug" mode, or in code
> generated when optimization is enabled.]

	Nit: usually, there's no such thing as an 'error' in Python.

> Essentially, even the assert statement is rigidly defined. I strongly
> believe that type assertions would follow the exact pattern of regular
> assertions.

	So do I. But I don't agree that the _formal_ semantics
of the language define the behaviour of an assertion when it
fails. The behaviour when it succeeds is 'none'.

	Of couse, since the 'reference manual' is not
as formal as it might be, my belief is not backed up
by a formal specification.

-- 
John Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850