Introduce a dedicated isinstance function implementation.

This commit is contained in:
Dave Halter
2014-08-19 23:57:59 +02:00
parent 49163e135c
commit 09ca47fa93
4 changed files with 48 additions and 16 deletions

View File

@@ -421,6 +421,17 @@ true_obj = builtin.get_by_name('True')
object_obj = builtin.get_by_name('object')
def keyword_from_value(obj):
if obj is None:
return none_obj
elif obj is False:
return false_obj
elif obj is True:
return true_obj
else:
raise NotImplementedError
def compiled_objects_cache(func):
def wrapper(evaluator, obj, parent=builtin, module=None):
# Do a very cheap form of caching here.