Python for air traffic control?

Aahz Maruch aahz at panix.com
Thu Jul 5 15:33:01 CEST 2001


In article <bebbba07.0107042341.4283ca43 at posting.google.com>,
Russ <18k11tm001 at sneakemail.com> wrote:
>
>Let's cut right to the chase here. I like strong typing almost as much
>as you do, but I don't understand why I can't get it in Python,
>perhaps by specialized code-analysis tools. Is the problem just that
>the development tools are underdeveloped, or is there a fundamental
>technical reason that type-checking cannot be done? If it's the
>former, then I suggest that the tools be given a very high priority.
>If it's the latter, then perhaps type checking can be done under
>certain reasonable restrictions. Whatever the case, I want to have my
>cake and eat it too. :-)

Python simply has no direct mechanisms for enforcing type control
*except* for the fact that performing an incorrect operation on an
object will raise an exception.  That is, if you attempt

    foo.append(bar)

and foo does not have an append method, you'll get an exception.  That
is the entire basis of Python's built-in type control.  Now, you can use
Python's introspective capabilities to pre-test for this, but there's
rarely any reason to do so.  What you want to do is fail gracefully --
the tricky part is defining what is "graceful" within your application.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

So much Astroglide.  So little time.



More information about the Python-list mailing list