1
0
forked from VimPlug/jedi

Implement the type builtin better and with a lot more tests.

This commit is contained in:
Dave Halter
2015-07-01 14:27:49 +02:00
parent 80492265cf
commit e222a30227
3 changed files with 27 additions and 2 deletions

View File

@@ -65,6 +65,9 @@ class GeneratorMixin(object):
def py__bool__(self):
return True
def py__class__(self, evaluator):
return compiled.generator_obj.py__class__(evaluator)
class Generator(use_metaclass(CachedMetaClass, IterableWrapper, GeneratorMixin)):
"""Handling of `yield` functions."""
@@ -160,6 +163,9 @@ class ArrayMixin(object):
def py__bool__(self):
return None # We don't know the length, because of appends.
def py__class__(self, evaluator):
return compiled.builtin.get_by_name(self.type)
class ListComprehension(Comprehension, ArrayMixin):
type = 'list'