As pointed out by @glassnotes, functions such as q.hadamard currently do not behave well at all when given indices outside the valid range given by the number of qubits. For instance,
>>> print q.hadamard(1, 1)
XI |-> +XI
IX |-> +IZ
ZI |-> +ZI
IZ |-> +IX
>>> print q.phase(1, 3)
X[3] |-> +Y[3]
These should instead raise IndexError exceptions, since there's no sensible meaning to assign to "apply the phase gate to the fourth of one qubits."