Permalink
Browse files

+ Implemented callable()

  • Loading branch information...
Christian Iversen
Christian Iversen committed Jan 16, 2012
1 parent 7b39397 commit d03d118904bbc2d1e067205189bde23b9093832e
Showing with 8 additions and 1 deletion.
  1. +8 −1 pyjaco/stdlib/10-builtin.js
@@ -70,7 +70,14 @@ __builtins__.PY$bin = function(num) {
__builtins__.PY$buffer = $PY.c_nif;
__builtins__.PY$bytearray = $PY.c_nif;
__builtins__.PY$bytes = $PY.c_nif;
-__builtins__.PY$callable = $PY.c_nif;
+
+__builtins__.PY$callable = function(obj) {
+ if (typeof obj === "function" && obj.PY$__class__ === undefined) {
+ return True;
+ } else {
+ return __builtins__.PY$hasattr(obj, "__call__");
+ }
+};
__builtins__.PY$chr = function(chr) {
var s = String.fromCharCode(chr._js_());

0 comments on commit d03d118

Please sign in to comment.