Message198225
| Author |
terry.reedy |
| Recipients |
chortos, petri.lehtinen, python-dev, serhiy.storchaka, terry.reedy, vstinner |
| Date |
2013年09月21日.21:19:32 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1379798372.62.0.017302955484.issue12085@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
A class attribute is still a special case fix to a generic problem, if indeed the message is a problem.
If class attribute backup is to become a requirement of all delete methods, it needs to first be documented, after pydev discussion. To apply the class attribute fix generally is tricky. If one does not create a class attribute backup for every attribute referenced in __del__, one must analyze the __init__ method for all points of possible failure, to see which attributes referenced in __del__ might be missing. Changing __init__ might change the analysis. This looks like a bad path to me.
The whole point of the special case ignoring of AttributeError in __delete__ methods is that AttributeErrors are *expected* in certain circumstances.
I opened a thread on pydev to discuss this issue.
"Revert #12085 fix for __del__ attribute error message"
The OP can avoid this issue entirely by using a conditional
if sys.version_info < (3, 2, 0)
I consider this better code than intentionally creating an uninitialized instance. |
|