On 4/25/07, Jim Jewett <[EMAIL PROTECTED]> wrote:
> On 4/25/07, guido.van.rossum <[EMAIL PROTECTED]> wrote:
> > + implementation.) **Open issues:** Forcing every mutable set
> > + to implement this may be a pain for such a fairly
> > + non-essential method. Perhaps just drop it?
>
> There are also comments worrying that an abstract implementation would
> be horribly slow -- but so what?
True. In the discussion of __hash__ returning 0 by default I even
mention that I'd rather be slow and correct than fast and wrong. :-)
> Alex Martelli posted some stats (for dicts, I think) showing that
> (even today) clear was slower than just creating a new object.
:)
> It still makes sense if you care about the "is" relation
>
> Since you are keeping "pop", the abstract implementation can at least
> approximate iteration.
>
> def clear(self):
> while self.pop(): pass
That would have to be
def clear(self):
while True:
try:
self.pop()
except KeyError:
break
But yeah, I'll do this. Thanks for the reality check!
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com