[Numpy-discussion] array slicing question

konrad.hinsen at laposte.net konrad.hinsen at laposte.net
Sun Apr 3 13:03:19 CDT 2005


On 03.04.2005, at 15:31, Gary Ruben wrote:

> You might think you could do
> >>> p=1
> >>> b = a[p:-p]
>
> but if p=0, this fails.

b = a[p:len(a)-p] works even for p=0.

Konrad.
--
------------------------------------------------------------------------ 
-------
Konrad Hinsen
Laboratoire Leon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr
------------------------------------------------------------------------ 
-------





More information about the Numpy-discussion mailing list