Skip to content

Instantly share code, notes, and snippets.

@stucox stucox/patch.diff
Created May 7, 2012

Embed
What would you like to do?
Patch for pyjon to support Underscore.js
diff --git a/pyjon/interpr.py b/pyjon/interpr.py
index 5520d95..4c639b4 100644
--- a/pyjon/interpr.py
+++ b/pyjon/interpr.py
@@ -1467,6 +1467,11 @@ class array_proto(list, Prototype):
def pop(self): return list.pop(self)
@publicmethod
+ def sort(self, sortfn=None):
+ list.sort(self, sortfn)
+ return self
+
+ @publicmethod
def slice(this, s=0, i=None):
if i == None: i = len(this)
return array_proto(*this[s:i])
@@ -1518,6 +1523,7 @@ class Array(JS_Function):
def __getattr__(self, k):
if k == 'constructor': return array
elif k == '__proto__': return array_prototype
+ elif k == 'isArray': return isArray
else: Prototype.__getattr__(self, k)
def __newInstance__(self, *args):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.