[Numpy-discussion] How is NumPy implemented?
Thu Jun 28 16:00:02 CDT 2007
I see. Thanks a lot.
[mailto:firstname.lastname@example.org] On Behalf Of Tom Denniston
Sent: Thursday, June 28, 2007 3:33 PM
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] How is NumPy implemented?
That is normal python syntax. It works with lists. What is slightly
unusual is the multi-dimensional slicing as in arr[:,10:20]. However,
this is governed by the way python translates bracket index calls to
the __getitem__ and __getslice__ methods. You can try it out yourself
in ipython or your favorite interpretter by writing the following
In : class GetItemInspect(object):
...: def __getitem__(self, slices):
...: print slices
In : GetItemInspect()[:,:,10:]
(slice(None, None, None), slice(None, None, None), slice(10, None,
This allows you to play with the translation semantics. I'm sure they
are also documented somewhere but I usually find trying many examples
On 6/28/07, Geoffrey Zhu <email@example.com> wrote:
> Hi All,
> I am curious how numpy is implemented. Syntax such as x[10::-2] is
> completely foreign to Python. How does numpy get Python to support it?
> PS. Ignore the disclaimer. The mail server automatically insert that.
> The information in this email or in any file attached=0A= hereto is
> intended only for the personal and confiden-=0A= tial use of the
> individual or entity to which it is=0A= addressed and may contain
> information that is propri-=0A= etary and confidential. If you are
> not the intended=0A= recipient of this message you are hereby notified
> that=0A= any review, dissemination, distribution or copying of=0A=
> this message is strictly prohibited. This communica-=0A= tion is
> for information purposes only and should not=0A= be regarded as an
> offer to sell or as a solicitation=0A= of an offer to buy any
> financial product. Email trans-=0A= mission cannot be guaranteed to be
> secure or error-=0A= free. P6070214
> Numpy-discussion mailing list
Numpy-discussion mailing list
More information about the Numpy-discussion