[Python-3000] Making more effective use of slice objects in Py3k

Paul Moore p.f.moore at gmail.com
Mon Aug 28 11:08:31 CEST 2006


On 8/28/06, Delaney, Timothy (Tim) <tdelaney at avaya.com> wrote:
> For when/*if* views ever become considered to be a good thing for
> builtin classes, etc, may I suggest that the following syntax be
> reserved for view creation:
>
>     obj{start:stop:step}
>
> mapping to something like:
>
>     def __view__(self, slice)
>
> So if you really want a string view, use:
>
>     s{1:2}
>
> instead of:
>
>     s[1:2]
>
> I don't *think* the syntax is currently legal, and I don't think it
> could ever be ambiguous - anyone think of a case where it could be?

OTOH, it is very subtle. I had to lean closer to the monitor before I
could even see the distinction you were making! (OK, some of that is
due to less-than-ideal fonts plus failing eyesight, but the point
remains...)

Paul.


More information about the Python-3000 mailing list