[Numpy-discussion] Simple problem. Is it possible without a loop?

Robert Elsner mlist at re-factory.de
Wed Jun 9 04:34:40 EDT 2010


Well happens. The problem description was not 100% clear thus I still
think your line did solve the problem. A simple misunderstanding. So
what do I learn from it?: Always look at the code, not the
description :D

Am Mittwoch, den 09.06.2010, 10:19 +0200 schrieb Francesc Alted:
> A Wednesday 09 June 2010 10:14:22 V. Armando Solé escrigué:
> > That was my first thought, but that only warrants me to skip one point
> > in x but not more than one.
> > 
> >  >>> x= numpy.arange(10.)
> >  >>> delta = 3
> >  >>> print x[(x[1:] - x[:-1]) >= delta]
> > 
> > []
> > 
> > instead of the requested [0, 4, 8]
> 
> True!  Wanting to be fast always makes you ending with the wrong result :-/
> 





More information about the NumPy-Discussion mailing list