On Wed, Mar 4, 2009 at 00:56, David Warde-Farley <[email protected]> wrote: > On 3-Mar-09, at 11:41 PM, Jonathan Taylor wrote: > >> def rotation(theta, R = np.zeros((3,3))): > > Hey Jon, > > Just a note, in case you haven't heard this schpiel before: be careful > when you use mutables as default arguments. It can lead to unexpected > behaviour down the line. > > The reason is that the np.zeros() is only called once when the > function is read by the interpreter, and that reference is retained > between calls.
I'm pretty sure that's exactly why he did it, and that's what he's calling evil. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
