David M. Cooke wrote: > On Tue, 29 Aug 2006 14:03:39 -0700 > Tim Hochberg <[EMAIL PROTECTED]> wrote: > > >> Of these, clip, conjugate and round support an 'out' argument like that >> supported by ufunces; byteswap has a boolean argument telling it >> whether to perform operations in place; and sort always operates in >> place. Noting that the ufunc-like methods (max, argmax, etc) appear to >> support the 'out' argument as well although it's not documented for most >> of them, it looks to me as if the two odd methods are byteswap and sort. >> The method situation could be made more consistent by swapping the >> boolean inplace flag in byteswapped with another 'out' argument and also >> having sort not operate in place by default, but also supply an out >> argument there. Thus: >> >> b = a.sort() # Returns a copy >> a.sort(out=a) # Sorts a in place >> a.sort(out=c) # Sorts a into c (probably just equivalent to c = a.sort() >> in this case since we don't want to rewrite the sort routines) >> > > Ugh. That's completely different semantics from sort() on lists, so I think > it would be a source of bugs (at least, it would mean keeping two different > ideas of .sort() in my head). > Thinking about it a bit more, I'd leave sort alone (returning None and all).. I was (over)reacting to changing to sort to return self, which makes the set of methods both less consistent within itself, less consistent with python and more error prone IMO, which seems the worst possibility.
For the moment at least I do stand by the suggestion of changing byteswap to match the rest of the methods, as that would remove one outlier in the set methods. -tim ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion