Good way to make a multi dimensional array without numpy

arrays, python

Solution

If the array is sparse (rare True values); you could use `collections.defaultdict`:

from collections import defaultdict

a = defaultdict(bool)
a[i,j,k,m] = True

Problem

I need some way to keep track of a four dimensional array of boolean flags. Just True/False values. It seems that numpy is the canonical way to do such things, but it seems rather more complicated to install than I really want to deal with. (I need to work in multiple OS environments.) So, is there a straightforward way, or simple module, that would let me store and fetch True/False values from a four dimensional array without digging myself a mound of spaghetti deeper than the ocean? I could do a list of lists of lists of lists, but that seems rather clumsy.

Original source