En Mon, 29 Oct 2007 20:26:40 -0300, Abandoned <[EMAIL PROTECTED]> escribió:

> Now this is my real code and the problem  continue.
> What is the mistake?

I don't see where you define "query" so this can't be your complete code.

>
> import threading
>
>
> class GetData(threading.Thread):
>    def __init__(self, name):
>       threading.Thread.__init__(self)
>       self.name = name
>
>
>    def run(self):
>         self.data={2:3, 3:4}
>
>
> i=0
> datas={"n": [['msn']]}
> nglist=nlist={0: list()}

Here, you make nglist and nlist refer to the same object (a dictionary,  
not a list!)
To be short: nglist and nlist are the same thing

> for x in query:
>         tip=x
>         for a in datas[x]:
>                 for o in a:
>                         if len(o)>1:
>                                 current = GetData(o)
>                                 nglist[i].append(current)
>                                 current.start()

Here, you append current to nglist[i]. current is an instance of the  
GetData class, a Thread. As nglist is the same thing as nlist, nlist[i]  
contains a GetData instance too.

>         i=i+1
>
> for x in range(0,len(nglist)):
>         for jk in range(0,len(nglist[x])):
>                 jkl=nglist[x][jk]
>                 jkl.join()
>                 sonuc=jkl.data
>                 nlist[x].append(sonuc)
>
> print nlist
> {0: [<GetData(Thread-1, stopped)>, {2: 3, 3: 4}]}

It's not surprising to see here the object appended above.

I can't say how to improve/fix this because I can't see the purpose of all  
this. Could you explain what do you want to do exactly?

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to