optional static typing for Python

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Tue Jan 29 19:14:38 EST 2008


On 28 jan, 11:21, "Russ P." <Russ.Paie... at gmail.com> wrote:
> On Jan 28, 1:53 am, Bruno Desthuilliers <bruno.
>
>
>
> 42.desthuilli... at wtf.websiteburo.oops.com> wrote:
> > Russ P. a écrit :
>
> > > On Jan 27, 5:03 pm, Paddy
>
> > >> If static typing is optional then a program written in a dynamic
> > >> language that passes such an automated static analysis of source code
> > >> would have to be a simple program written in a simplistic way, and
> > >> also in a static style.
>
> > > Yes, but for safety-critical software you usually want the simplest
> > > possible solution. The last think you want is an unnecessarily "fancy"
> > > design. Unless there is a darn good reason to write a "non-static"
> > > program, you just don't do it.
>
> > > You might want to check into what the FAA allows in "flight-critical"
> > > code, for example. I am certainly not an expert in that area, but I've
> > > had a passing exposure to it. My understanding is that every possible
> > > branch of the code must be fully and meticulously analyzed and
> > > verified. Hence, the dynamic dispatching of ordinary object-oriented
> > > code is either prohibited or severely frowned upon.
>
> > Then Python is definitively out, so this whole thread is pointless.
>
> Yes, Python as it stands now is "definitely out" as the ultimate
> implementation language for flight-critical software. That's
> essentially a no-brainer. But it can certainly be useful as a
> prototyping language for R&D.
>
> The question then arises as to how to best make use of the prototype.
> Do you throw away the code and start from scratch? That doesn't seem
> wise to me. But maybe that's because I have some idea of how much
> effort can go into developing a good prototype.
>
> If Python could be automatically converted to Ada or Java, that could
> potentially be used as a baseline for actual operational software.
> That would capture the algorithmic details more reliably than recoding
> from scratch by hand. But such an automatic conversion is not feasible
> without explicit typing.

As far as I can tell, this should be possible using type annotations
and some "soft" (ie: coding style guideline) restrictions on the most
dynamic features. This may even be possible without type annotation,
if I refer to the work being done on RPython for Pypy.

This being said, I don't personaly believe that much in "automatic
conversion" from Python to Java or Ada, because a language is not only
made of a syntax and grammar, but also of idioms, and I really doubt
you'll get idiomatic Java or Ada from idiomatic Python - unless your
Python code is written in Javaish (or Ada-ish) idioms, in which case
using Python is IMHO, well, how to say... somewhat pointless ?-)

> And speaking of "pointless," ... I just wasted a significant amount of
> time replying to a pointless post. Oh, well.

Coming from someone posting here that declarative static typing would
make a better Python just because *he* thinks he have a need for it,
without any consideration for the fact that most people here use
Python because they don't actually want static typing, and without
even realizing that most of what makes Python great for prototyping is
it's dynamism, I do find this use of terms like "pointless" and "waste
of time" *very* amusing. Almost as amusing as this other post where
you so kindly worried about my job and personal life.




More information about the Python-list mailing list