declaration of variables?

Carl Banks imbosol-1045376930 at
Sun Feb 16 08:17:17 CET 2003

Andr? Jonsson wrote:
> Being a Python-n00b, in the midst of this ?: discussion, it occurred
> to me that Python does not require variables be delcared before use.
> Why is this so?  Isn't it very helpful if the compiler complains
> rather than having strange run-time results?
> Surely, in an elightened language like Python it shouldn't be
> possible to do this kind of error without the compiler complaining.

Some would say you'll spend more time typing in declarations than you
would debugging spelling errors.

I guess it depends on the person, but that's certainly true of me.  In
fact, I get more errors when declarations are required; not because I
misspell the variables, but because I forget the damn declarations.

> The compiler.compileFile() function doesn't complain either, nor
> does pychecker seem to. It's almost as if it was by design... is it?



More information about the Python-list mailing list