It is another example showing the difference of generator references (g, 
self.g, and (g,)). 

          #file name: test_generator.py

import pyjd # this is dummy in pyjs.
class GUI():
    def onModuleLoad(self):
        g=test_generator()
        self.g=g
        self.g_tuple=(g,)
        print 'g=%s, type(g)=%s' % (g, type(g))
        print 'self.g=%s, type(self.g)=%s' % (self.g,  type(self.g))
        print 'self.g_tuple[0]=%s, type(self.g_tuple[0])=%s' % 
(self.g_tuple[0],  type(self.g_tuple[0]))

def test_generator():
    yield 'the first yield in func_async1'

pyjd.setup('public/GUI.html')
gui = GUI()
gui.onModuleLoad()
pyjd.run()


result:

g=function () {}, type(g)=class pyjslib.FunctionType
self.g=class g, type(self.g)=class test_generator.GUI
self.g_tuple[0]=function () {}, type(self.g_tuple[0])=class 
pyjslib.FunctionType


As you can see, direct reference(g) and tuple element(g_tuple[0]) are 
equal, but the object member reference (self.g) is different. They are all 
the same in Pyjd. They are different only in Pyjs.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Pyjs.org Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyjs-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to