Ludwig wrote: > What are the relative merits of > > sum(a[where(a>0]) > > to > > a[a > 0].sum() > > ? > Second one is more OO, takes a few keystrokes less to type. Is there > any real difference if it came to very large arrays? Or is it 'just' a > style question?
In this case, it is style: sum(a) really calls a.sum() internally; in the second case, you are sure to call numpy sum, and not python sum, which is a common mistake of people new to numpy. cheers, David _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
