[Python-3000] ABC PEP -- dropping set.clear (original) (raw)
Jim Jewett jimjjewett at gmail.com
Thu Apr 26 02:31:39 CEST 2007
- Previous message: [Python-3000] ABC PEP isinstance issue Was: PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)
- Next message: [Python-3000] ABC PEP -- dropping set.clear
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4/25/07, guido.van.rossum <python-checkins at python.org> 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?
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
-jJ
- Previous message: [Python-3000] ABC PEP isinstance issue Was: PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)
- Next message: [Python-3000] ABC PEP -- dropping set.clear
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]