class Cone(object): pass X = 5 Y = 3 Z = 2 cones = [ [ [ Cone() for z in xrange(Z) ] for y in xrange(Y) ] for x in xrange(X) ]