[Python-ideas] No implicit variable declarations

Chris Angelico rosuav at gmail.com
Sat Apr 12 21:02:06 CEST 2014


On Sun, Apr 13, 2014 at 4:53 AM, Markus Unterwaditzer
<markus at unterwaditzer.net> wrote:
> On Sat, Apr 12, 2014 at 06:14:04PM +0000, James Nelson wrote:
>> I don't believe that having var and implicit keywords would make the
>> language less flexible -- they are completely optional, remember. If you
>> omit "implicit none" from the beginning of your program you can write your
>> program like you do now, implicit variable declarations and all.
>
> At which scope should this statement operate? Should it only be allowed at the
> top of a module (like __future__ imports), or should it operate on a
> per-function basis? Doing this for the whole process, as i think your usage of
> the term "program" implies, sounds like a very bad idea to me.

As it's something that doesn't change bytecode execution (other than
the extra info on NameError, which as mentioned can be done regardless
of this proposal) but effects a change to syntax, I would recommend it
be per-module, like a future directive.

ChrisA


More information about the Python-ideas mailing list