[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200925061413.5e166662@coco.lan>
Date: Fri, 25 Sep 2020 06:14:13 +0200
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Jonathan Corbet <corbet@....net>
Cc: Linux Doc Mailing List <linux-doc@...r.kernel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] docs: cdomain.py: add support for two new Sphinx
3.1+ tags
Em Thu, 24 Sep 2020 10:22:25 -0600
Jonathan Corbet <corbet@....net> escreveu:
> On Thu, 24 Sep 2020 18:13:54 +0200
> Mauro Carvalho Chehab <mchehab+huawei@...nel.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.
Ok! Thanks for helping with this. I'll declare namespace as global for
the next version.
Thanks,
Mauro
Powered by blists - more mailing lists