[Types-sig] Re: Pascal style declarations

Christian Tismer tismer@appliedbiometrics.com
Tue, 14 Dec 1999 23:53:33 +0100

Greg Stein wrote:
> On Tue, 14 Dec 1999, Golden, Howard wrote:


> We already have expr-based (the "assert" statement) -- we can assert types
> on expressions anywhere. It is just a little less convenient since we must
> place the expression value into a temporary variable, assert the type of
> that, then continue with the expression. The "type-assert operator"
> simplifies this process dramatically.

Why not use "assert" instead of "as" as an operator?

def f(x):
    a = x assert int
    #... stuff
    return str(x) + g(x) assert string # assert binding low precedence

Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home