forcing variable declaration ??

Axel Kowald kowald at molgen.mpg.de
Wed May 28 05:10:58 EDT 2003


Hello Carl,

Indeed, that is what I was looking for :-)
But I will also have a look at pychecker

    Many thanks,
                                     Axel

                                     

Carl Banks wrote:

>
>Yes, there's a trick:
>
>    def declare(declaration_list):
>        import sys
>        vars = sys._getframe(1).f_code.co_varnames
>        for v in vars:
>            if v not in declaration_list:
>                raise DeclarationError, "local variable '%s' not declared" % v
>





More information about the Python-list mailing list