Re: [Numpy-discussion] sum and prod

2012-09-08 Thread eat
Hi, On Sun, Sep 9, 2012 at 12:56 AM, nicky van foreest wrote: > Hi, > > I ran the following code: > > args = np.array([4,8]) > print np.sum( (arg > 0) for arg in args) > print np.sum([(arg > 0) for arg in args]) > print np.prod( (arg > 0) for arg in args) >

Re: [Numpy-discussion] sum and prod

2012-09-08 Thread Warren Weckesser
On Sat, Sep 8, 2012 at 4:56 PM, nicky van foreest wrote: > Hi, > > I ran the following code: > > args = np.array([4,8]) > print np.sum( (arg > 0) for arg in args) > print np.sum([(arg > 0) for arg in args]) > print np.prod( (arg > 0) for arg in args) > print

Re: [Numpy-discussion] sum and prod

2012-09-08 Thread Han Genuit
Hi, Maybe try something like this? >>> args = np.array([4,8]) >>> np.prod(args > 0) 1 >>> np.sum(args > 0) 2 Cheers, Han ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] sum and prod

2012-09-08 Thread nicky van foreest
Hi, I ran the following code: args = np.array([4,8]) print np.sum( (arg > 0) for arg in args) print np.sum([(arg > 0) for arg in args]) print np.prod( (arg > 0) for arg in args) print np.prod([(arg > 0) for arg in args]) with this result: 2 1 at 0x1c7041

Re: [Numpy-discussion] problem with scipy's test

2012-09-08 Thread Ralf Gommers
On Wed, Sep 5, 2012 at 6:57 PM, 心如烛光 <275438...@qq.com> wrote: > Hi,every body. > I encounter the error while the scipy is testing . > I wanna know why and how to fix it.(OSX lion 10.7.4) > here is part of the respond: > See http://thread.gmane.org/gmane.comp.python.scientific.devel/1