Exemple #1
0
def equals(arrayA, arrayB):
    if not hasattr(arrayA, '__getitem__') or not hasattr(arrayB, '__getitem__') :
        raise CalcException('E: %s is not subscriptable')

    try:
        return unpack_variable((arrayA and arrayB))
    except (TypeError, IndexError) as e:
        raise CalcException('E: %s' % str(e))
Exemple #2
0
def insert(array, index, _object):
    if not hasattr(array, '__getitem__'):
        raise CalcException('E: %s is not subscriptable')

    try:
        v = array.insert(int(index), _object)
    except (TypeError, IndexError) as e:
        raise CalcException('E: %s' % str(e))
    
    return unpack_variable(v)
Exemple #3
0
def remove(array, _object):
    if not hasattr(array, '__getitem__'):
        raise CalcException('E: %s is not subscriptable')

    try:
        v = array.remove(_object)
    except (TypeError, IndexError) as e:
        raise CalcException('E: %s' % str(e))
    
    return unpack_variable(None)
Exemple #4
0
def get(array, index):
    #a = unpack_variable(check_variable(array))
    #i = unpack_variable(check_variable(index))

    if not hasattr(array, '__getitem__'):
        raise CalcException('E: %s is not subscriptable')

    try:
        v = array[int(index)]
    except (TypeError, IndexError) as e:
        raise CalcException('E: %s' % str(e))
    
    return unpack_variable(v)