c[:]()

Grant Edwards grante at visi.com
Thu May 31 13:23:04 EDT 2007


On 2007-05-31, Steve Holden <steve at holdenweb.com> wrote:

>> I still don't see how c[:] is any different from c.
>
> It isn't. The OP is projecting a wish for a function call on a
> list to be interpreted as a call on each member of the list
> with the same arguments.

Yea, I got that part.

> The all-members slice notation is a complete red herring.

That's what I thought, but the OP seems convinced that c[:] is
somehow behaviorally different than c (something more than just
being an exact copy of the list with a different id()).  

The only thing I could think of is that he has overridden the
__getitem__ method of the class to which c belongs with
something that has some sort of side-effects which he wishes to
invoke.

> It would require a pretty fundamental re-think to give such a
> construct sensible and consistent semantics, I think.

He could just define a container class that does what he
wants...

-- 
Grant Edwards                   grante             Yow! Mr and Mrs PED, can I
                                  at               borrow 26.7% of the RAYON
                               visi.com            TEXTILE production of the
                                                   INDONESIAN archipelago?



More information about the Python-list mailing list