Op 2006-03-28, Georg Brandl schreef <[EMAIL PROTECTED]>:
> Fabiano Sidler wrote:
>> I really wanted to learn the reason for this, nothing else! ;)
>
> I suspect performance reasons. Can't give you details but function
> is used so often that it deserves special treatment.

I would find this a bit odd. I think integers, tuples and lists
are used just as often if not more and they aren't treated special.

I for one would gladly treat some performance for the ability
to subclass slices.

  class islice(slice):
    ...

doesn't work


And if I just write

  class islice:

     def __init__(self, start, stop, step):
       self.start = start
       self.stop = stop
       self.step = step

then the following doesn't work:

  lst = range(20)
  sl = islice(2,6,None)
  lst[sl]


So much for ducktyping.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to