Warning when doubly linked list is defined gloablly
Benjamin Niemann
pink at odahoda.de
Wed Aug 24 07:23:11 EDT 2005
chand wrote:
> Hi.,
>
> In my api.py file 'g_opt_list' is defined globally
> g_opt_list =[[],[],[],[],[],[],[]]
>
> I am using this global list in the fucntion
>
> def function ():
> gloabl g_opt_list
global?
> when I run the py file, I am getting the Following Error
>
> SyntaxWarning: name 'g_opt_list' is used prior to global declaration
>
> Please let me know how to remove this error
This happens in cases like
>>> a = 1
>>> def c():
... a
... global a
Does your source only consist of the three lines above? (These would trigger
a SyntaxError because of the typo...)
You should provide a more complete example, so we can tell you where the
problem is. Try to build a minimal file that reproduces the problem. Often
you will find the line causing the error yourself - and the fix might be
obvious to you -, if your strip stuff away.
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
More information about the Python-list
mailing list