Enumerate Python objects in JavaScript
-
Paul J. Davis
- Tag changed from python-wrapping to python, wrapping
-
Paul J. Davis
- Tag changed from python, wrapping to iterators, python, wrapping
- State changed from new to open
I have the initial support for iterating python objects in the JS vm. This syntax is supported:
for(var v in obj) { // do something with v }But I still have to add a check so that I can do the following syntax:
for each(var v in obj) { // do something with v }The difference being that 'for()' returns the property names (or indexes for arrays) while 'for each()' returns the value associated with each property (or array index).
This should be fairly straightforward to add because the next() function gets passed a boolean value that indicates if it wants the name vs. the value.
-
Paul J. Davis
- State changed from open to resolved
(from [fd5307a25d574ec655e41929a8a4a1be860068ca]) 'for each' iteration support in JavaScript.
Added the 'for each(var v in obj)' semantics to iteration.
[#1 Enumerate Python objects in JavaScript state:resolved] http://github.com/davisp/python-...
-
Paul J. Davis
(from [e75f991342e41d62647aa5f557eaff784598ff4b]) Fix integer property lookups.
>>> rt = spidermonkey.Runtime() >>> cx = rt.new_context() >>> cx.add_global("bang", [2, "got me!"]) >>> assert cx.execute("bang[1];") == "got me!"Thanks to spahl for the report and fix.
[#16 TypeError: bad argument type for built-in operation state:resolved] http://github.com/davisp/python-spidermonkey/commit/e75f991342e41d6...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.