This commit is contained in:
David Halter
2012-04-24 16:01:55 +02:00
parent 7de81ca4a5
commit 470e52e95d
3 changed files with 52 additions and 22 deletions

View File

@@ -808,6 +808,16 @@ class Array(Call):
raise AttributeError("More than one value found")
return self.values[0][0]
@staticmethod
def is_type(instance, typ):
"""
This is not only used for calls on the actual object, but for
ducktyping, to invoke this function with anything as `self`.
"""
if isinstance(instance, Array):
if instance.type == typ:
return True
return False
def __len__(self):
return len(self.values)