1
0
forked from VimPlug/jedi

small evaluate.iterable.Array optimization

This commit is contained in:
Dave Halter
2014-04-22 10:13:23 +02:00
parent eaf54942fc
commit 2a0423302c

View File

@@ -98,7 +98,8 @@ class Array(use_metaclass(CachedMetaClass, pr.Base)):
self._evaluator = evaluator self._evaluator = evaluator
self._array = array self._array = array
def get_index_types(self, indexes=[]): @memoize_default()
def get_index_types(self, indexes=()):
""" """
Get the types of a specific index or all, if not given. Get the types of a specific index or all, if not given.
@@ -455,7 +456,7 @@ class Slice(object):
def create_indexes_or_slices(evaluator, index_array): def create_indexes_or_slices(evaluator, index_array):
if not index_array: if not index_array:
return [] return ()
# Just take the first part of the "array", because this is Python stdlib # Just take the first part of the "array", because this is Python stdlib
# behavior. Numpy et al. perform differently, but Jedi won't understand # behavior. Numpy et al. perform differently, but Jedi won't understand
@@ -473,6 +474,6 @@ def create_indexes_or_slices(evaluator, index_array):
else: else:
stop = prec.right stop = prec.right
step = None step = None
return [Slice(evaluator, start, stop, step)] return (Slice(evaluator, start, stop, step),)
else: else:
return evaluator.process_precedence_element(prec) return tuple(evaluator.process_precedence_element(prec))