This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients barry, eli.bendersky, ethan.furman, r.david.murray, vajrasky
Date 2013-09-15.18:01:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1379268063.35.0.417424306997.issue19025@psf.upfronthosting.co.za>
In-reply-to
Content
As for the error messages (going in reverse order):

==========================================================================
--> del cute_cat.name
Traceback (most recent call last):
...
AttributeError: can't delete attribute
==========================================================================

This is the same error given by @property.


==========================================================================
--> del MyPet.spam
--> hasattr(MyPet, 'spam')
False
==========================================================================

This is correct.  Only Enum members get special treatment.


==========================================================================
--> del MyPet['LONELY_WOLF']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'EnumMeta' object does not support item deletion
==========================================================================

There are two errors here: LONELY_WOLF does not exist, and an operation is being attempted that is not supported.  Of those two, attempting the unsupported operation is the more serious, and should be the reported error.  (Yes, dealing with multiple errors at once can often be confusing.)


==========================================================================
--> del MyPet.CUTE_CAT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: CUTE_CAT
==========================================================================

This one I am not sure about (much as I am not sure about __getattr__ in #19011).  Enum members are virtual, and don't actually live in the class namespace.  I'm inclined to leave the existing behavior as is, but if we choose to change one, we should change both.
History
Date User Action Args
2013-09-15 18:01:03ethan.furmansetrecipients: + ethan.furman, barry, r.david.murray, eli.bendersky, vajrasky
2013-09-15 18:01:03ethan.furmansetmessageid: <1379268063.35.0.417424306997.issue19025@psf.upfronthosting.co.za>
2013-09-15 18:01:03ethan.furmanlinkissue19025 messages
2013-09-15 18:01:03ethan.furmancreate