from functools import reduce
import operator


def numVals(shape):
    """
    Return number of values in chunk of specified shape, given by a list of dimension lengths.
    shape -- list of variable dimension sizes"""
    if(len(shape) == 0):
        return 1
    return reduce(operator.mul, shape)