Warning when doubly linked list is defined gloablly

Terry Reedy tjreedy at udel.edu
Wed Aug 24 16:12:20 EDT 2005


"chand" <chandra.bangalore at gmail.com> wrote in message 
news:1124881914.018491.315800 at g14g2000cwa.googlegroups.com...
> 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
>
> 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

To expand slightly on previous answers:

1. Write a *minimal* file that gives you the error.  This means that 
removing any statement ceases to give you the error.  This may answer your 
questions.

2. If still puzzled, post again.  But cut and paste that *exact* file and 
also the *full* error traceback.

Terry J. Reedy






More information about the Python-list mailing list