1
0
forked from VimPlug/jedi

add __iter__method to InstanceElement, because it's needed for arrays

This commit is contained in:
David Halter
2013-07-24 17:21:49 +02:00
parent c8648d9ca5
commit 284f2f1671
3 changed files with 9 additions and 3 deletions

View File

@@ -220,6 +220,10 @@ class InstanceElement(use_metaclass(cache.CachedMetaClass, pr.Base)):
if not isinstance(command, unicode) else command
for command in self.var.get_commands()]
def __iter__(self):
for el in self.var.__iter__():
yield InstanceElement(self.instance, el, self.is_class_var)
def __getattr__(self, name):
return getattr(self.var, name)

View File

@@ -1260,9 +1260,11 @@ class Array(Call):
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):
try:
if instance.type in types:
return True
except AttributeError:
pass
return False
def __len__(self):

View File

@@ -154,9 +154,9 @@ def a(): return ''
class C():
def __init__(self):
self.a = (int(1)).real
self.a = (str()).upper()
#? int()
#? str()
C().a
# -----------------