[Python-bugs-list] [ python-Bugs-442791 ] 2.2a1: New style classes and __delitem__

noreply@sourceforge.net noreply@sourceforge.net
Thu, 19 Jul 2001 08:44:06 -0700


Bugs item #442791, was opened at 2001-07-19 08:44
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=442791&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Walter Dörwald (doerwalter)
Assigned to: Nobody/Anonymous (nobody)
Summary: 2.2a1: New style classes and __delitem__

Initial Comment:
And another one: New style class don't seem to support 
__delitem__:
----
class Foo(object):
   def __delitem__(self, key):
      print "__delitem__"

del Foo()[42]
----
This results in:
Traceback (most recent call last):
  File "test.py", line 5, in ?
    del Foo()[42]
TypeError: object doesn't support item deletion
----
Changing the base class to dictionary results in:
----
Traceback (most recent call last):
  File "test.py", line 5, in ?
    del Foo()[42]
KeyError: 42
----
but Foo.__delitem__ doesn't seem to be called.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=442791&group_id=5470