lkml.org 
[lkml]   [2020]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] docs: cdomain.py: add support for two new Sphinx 3.1+ tags
On Thu, 24 Sep 2020 18:13:54 +0200
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:

> > How can this possibly work without a "global namespace" declaration in
> > markup_namespace()?
>
> ... While I'm not a python expert, the namespace variable is global
> because it was defined outside the "markup_namespace" function.

Assignments within functions are *always* local unless declared global.

Try this:

$ python3
>>> x = 0
>>> def y(v):
>>> x = v
>>>
>>> y(1)
>>> x
0
>>>

So your assignment to "namespace" in markup_namespace() cannot change the
global, since it's not declared global.

jon

\
 
 \ /
  Last update: 2020-09-24 18:22    [W:0.045 / U:12.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site