]> granicus.if.org Git - python/commitdiff
Document the new semantics for setting and deleting a function's
authorBarry Warsaw <barry@python.org>
Tue, 14 Aug 2001 18:35:02 +0000 (18:35 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 14 Aug 2001 18:35:02 +0000 (18:35 +0000)
__dict__ attribute.  Deleting it, or setting it to a non-dictionary
result in a TypeError.  Note that getting it the first time magically
initializes it to an empty dict so that func.__dict__ will always
appear to be a dictionary (never None).

Closes SF bug #446645.

Misc/NEWS

index 97cb96e46a0dc64e59b4630544002da6f31c1736..e4870411c98e6d1456b127748f1f7b9cfaa59e8e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,12 @@ Core
   now use the Python warning framework (which makes it possible to
   write filters for these warnings).
 
+- A function's __dict__ (aka func_dict) will now always be a
+  dictionary.  It used to be possible to delete it or set it to None,
+  but now both actions raise TypeErrors.  It is still legal to set it
+  to a dictionary object.  Getting func.__dict__ before any attributes
+  have been assigned now returns an empty dictionary instead of None.
+
 Library
 
 - New class Differ and new functions ndiff() and restore() in difflib.py.