Adding optional 'explicit' declaration?

Remco Gerlich scarblac at pino.selwerd.nl
Thu Apr 26 08:45:00 EDT 2001


Laurent Pointal <pointal at lure.u-psud.fr> wrote in comp.lang.python:
> The idea is to optionnaly allow to force an explicit variable declaration 
> in Python functions/methods for compilation time check. 
> 
> The transparent creation of variables in Python is really nice, but there 
> are times when it become a bug source, essentially because of misstyping of 
> variable names.

Does anyone have any numbers on this? People make this claim all the time,
but in practice my typos are always caught at compile time or immediate
testing already. I believe bugs like this are really rare.

Does anyone have numbers from a real project on how many bugs were caused
by typos like this? What percentage of all bugs was that?

This looks to me like a feature request based on FUD that we're arguing
against with FUD, some facts would be nice...

> What do you think of this? 

The types-sig is a whole special interest group about this topic.

I think that there are many cases in which you can't do the checks at
compile time anyway (libraries that aren't strictly typed, eval()), and
even more cases in which type checking would be bad (passing a UserList
instead of a list). But that's mostly opinion, as I said, facts would be nice.

And similar to Alex's excellent rant, I hope people aren't trying to make
Python the one language to use for everything...

-- 
Remco Gerlich



More information about the Python-list mailing list