Hi,

How can I get a list of variables in an object?  (I need to get a list of 
variables in an object to allow a client to access the object in a server). 
Python provides vars(obj) and obj.__dict__() for this, but they are not 
implemented in Pyjs (or not implemented in the same way). Following is 
execution results of them:

    class TestClass:
        x=1

    vars(obj)                       ---> Error: Unknown exception: [object 
Error]
    obj.__dict__.keys()       ---> Error: The object doesn't support 
attribute 'keys'

obj.__dict__ exists in Pyjs, but it seems that it was not implemented in 
the same way in Python.  hasattr() works well, but obj.__dict__ returns the 
object itself, not the dict of obj.  I think that it is the reason why 
obj.__dict__.keys() throws an error.

    hasattr(obj, 'x')              --> True
    obj.__dict__                 --> instance of TestClass

I will try to fix it in Pyjs if that is the only way. Please let me know 
where I need to look at. 

Thanks.

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to