c[:]()

Grant Edwards grante at visi.com
Thu May 31 19:14:02 EDT 2007


On 2007-05-31, Jerry Hill <malaclypse2 at gmail.com> wrote:
> On 5/31/07, Warren Stringer <warren at muse.com> wrote:
>> In summation:
>>         I started this thread asking why c[:]() wouldn't work
>
> Because it's not part of the language.

It's got nothing to do with the OP's usage, but it will work if
you define a class which returns something callable from its
__getitem__ method when passed a slice, right?  It just won't
work for the built-in sequence types which always return a
sequence when you pass ':' to their __getitem__ method.  

I think. Or am I not understanding how slices and __getitem__
works.  In any case, that would be different that creating a
sequence class that can be called.

-- 
Grant Edwards                   grante             Yow! Not SENSUOUS ... only
                                  at               "FROLICSOME" ... and in
                               visi.com            need of DENTAL WORK ... in
                                                   PAIN!!!



More information about the Python-list mailing list