Created
July 17, 2012 18:32
-
-
Save Neppord/3131140 to your computer and use it in GitHub Desktop.
Pyjaco Discussion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass: | |
value = 0 | |
"""jsspace | |
MyClass.value = 0; | |
""" |
Author
Neppord
commented
Jul 17, 2012
var py = function(obj) {
if (obj && obj.PY$__class__ !== undefined) {
return obj;
} else if (typeof obj === 'number') {
return int(obj);
} else if (typeof obj === 'string') {
return str(obj);
} else if (typeof obj === 'boolean') {
return bool(obj);
} else if (obj === undefined || obj === null) {
return None;
} else if (obj instanceof Array) {
var res = list();
for (var q in obj) {
res.PY$append(py(obj[q]));
}
return res;
} else {
var res = dict();
for (var q in obj) {
res.PY$__setitem__(str(q), py(obj[q]));
}
return res;
}
};
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment