Python handles globals badly.

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Sep 4 00:13:12 CEST 2015


On 03/09/2015 20:47, Ian Kelly wrote:
> On Thu, Sep 3, 2015 at 1:05 PM,  <tdev at freenet.de> wrote:
>>      Or does anyone really name a global var xxx and a function var xxx?
>>      I am sure no one at all will do it. I dont want read such a code.
>
> Intentionally, it's probably rare. But if I'm adding a new variable, I
> shouldn't need to first make sure that it's safe to do so by scanning
> over the entire file to make sure that the name hasn't already been
> used elsewhere in the opposite scope.
>

I'm just curious as I've never used it myself, but how does nonlocal 
https://docs.python.org/3/reference/simple_stmts.html#the-nonlocal-statement 
fit into this?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-list mailing list