Jerry Sievers wrote:
I'd like to know;
1. what the Ellipsis object or ... syntax is used for
Use the Numeric (or numarray) package to really see these in use.
Otherwise, you mostly get to implement it yourself.

> 2. what a slice [..., j:k:l] does
Again, see numeric.  Essentially, select parts of a matrix (or higher
dimensional array) based on a stride in the last dimension.

3. how slices are applied to object of mapping types
One way to investigate this interactively:

class CheckOut(object):
    def __init__(self, name=None):
        self.name = name or str(self)
    def __getitem__(self, *args, **kwargs):
        print '%s._gi_(*%r, **%r):' % (self.name, args, kwargs),
        return input()

>>> c = CheckOut('a')
>>> b = c[1, ...]
c.gi(*(1, Ellipsis), **{}): self.name * 7
>>> b
'aaaaaaa'

--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to