how to send a json of yield list

meInvent bbird jobmattcon at gmail.com
Fri Oct 14 05:26:31 EDT 2016


when not to use queue, it is faster now

while True:
    for ii in getcombinations():
        item = ii
        print(item)
        sock.send(json.dumps(ii))
        

On Friday, October 14, 2016 at 5:11:35 PM UTC+8, meInvent bbird wrote:
> succeed to run,
> 
> is it the yield return the whole list 2000 * 2000 * 2000 items?
> 
> as i know that yield is return [1,1,1] etc one by one once it get
> 
> if it return 2000*2000*2000 items, why?
> 
> i have to add a queue get this yield in order to succeed
> 
> but i do not understand the situation when
> using queue and yield at the same time
> 
> will the speed same as the situation that no yield?
> 
> while True:
>     #time.sleep(1)
>     if q.qsize() > 0:
>         print("here1")
>         item = q.get()
>         print("here2")
>         #item = getcombinations()
>         sock.send(json.dumps(item))




More information about the Python-list mailing list