Python equivalent of 'use strict'

Joe Smith JoeSmith at bogusaddress.com
Wed Jan 17 01:37:01 EST 2001


I would like to have a compiler (or interpreter) option or something to force one to
declare variables.  Something similar to visual basick's "option explicit".  This
could prevent assignment to a mistyped variable.

Oldayz wrote:

> Would it perhaps be useful to have to indicate specifically that you're
> declaring a new variable with a keyword?
>
> import strict
>
> new a
> new b = 5
> a = b + 6
>
> c = 3 # raises an error
>
> I'm not sure I'd like it - I only used perl in a few tiny scripts and
> never did use strict, so I don't know how it'd feel.
>
> --
>
>         Andrei




More information about the Python-list mailing list