type checking

Carl Banks imbosol at aerojockey.invalid
Sun Oct 12 15:18:08 EDT 2003


sashan wrote:
> I'm a Python newbie. I have been using c++ for 5 years and before that I 
>  was programming in Pascal. The one thing that annoys me about python 
> is dynamic typing because I find myself making typographical errors of 
> the sort that would under C++ be picked up by the compiler at compiler 
> time.  With Python I have to wait for the error to appear at runtime in 
> order for me to correct it. I find this inefficient. Any advice about 
> how to get around this would be appreciated.


Sashan, it seems that what you are looking for is not static typing,
per se, but declarations.  Here's an old post I made about a trick
where you can declare variables, and have the function throw an
exception if there are any undeclared locals:

http://tinyurl.com/qnmc

It does not declare types, but it catches typos.  You might want to
use it to help you transition to Python.  However, if you're still
using Python a few months from now (likely :), I bet you'll have
adapted to Python's implicit variable declarations.


-- 
CARL BANKS                   http://www.aerojockey.com/software

As the newest Lady Turnpot descended into the kitchen wrapped only in
her celery-green dressing gown, her creamy bosom rising and falling
like a temperamental souffle, her tart mouth pursed in distaste, the
sous-chef whispered to the scullery boy, "I don't know what to make of
her." 
          --Laurel Fortuner, Montendre, France 
            1992 Bulwer-Lytton Fiction Contest Winner




More information about the Python-list mailing list