Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo:
- def __init__(self, x):
- self.x = x # an n-d array
- def pop_q(q, tuple):
- q = zeros(tuple)
- def set_q(q, i, j=None, qq):
- if q.ndim == 1:
- q[i] = qq
- else if q.ndim == 2:
- q[i, :] = qq
- else if q.ndim == 3:
- q[i, j, :] = qq
- def get_q(q, i, j=None):
- if q.ndim == 1:
- return q[i]
- else if q.ndim == 2:
- return q[i, :]
- else if q.ndim == 3:
- return q[i, j, :]
Add Comment
Please, Sign In to add comment