diff options
author | Guido van Rossum <guido@python.org> | 2001-12-05 19:46:42 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-12-05 19:46:42 (GMT) |
commit | d331cb550221cbf0a5863968ed272fb2afc90202 (patch) | |
tree | 55cd126e9bd86860463f2dd440f9dff890e25db5 /Lib/test/test_descr.py | |
parent | 698da02d3b0ce3364dc4e9bd61a47d73ca4e74a7 (diff) | |
download | cpython-d331cb550221cbf0a5863968ed272fb2afc90202.zip cpython-d331cb550221cbf0a5863968ed272fb2afc90202.tar.gz cpython-d331cb550221cbf0a5863968ed272fb2afc90202.tar.bz2 |
At the PythonLabs meeting someone mentioned it would make Jim really
happy if one could delete the __dict__ attribute of an instance. I
love to make Jim happy, so here goes...
- New-style objects now support deleting their __dict__. This is for
all intents and purposes equivalent to assigning a brand new empty
dictionary, but saves space if the object is not used further.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 48d1138..b73025b 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2261,12 +2261,7 @@ def setdict(): cant(a, None) cant(a, []) cant(a, 1) - try: - del a.__dict__ - except TypeError: - pass - else: - raise TestFailed, "shouldn't allow del %r.__dict__" % (a) + del a.__dict__ # Deleting __dict__ is allowed # Classes don't allow __dict__ assignment cant(C, {}) |