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, ned.deily, python-dev, ronaldoussoren
Date 2013-09-15.23:51:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1379289109.95.0.531818573236.issue18693@psf.upfronthosting.co.za>
In-reply-to
Content
Two issues still remain:

  - custom behavior, as well as value and name, don't show in help
  - value and name, if defined as enum members, show up as data 
    descriptors in help

=======================================================================================
--> class Test(enum.Enum):
...   this = 'that'
...   these = 'those'
...   whose = 'mine'
...   name = 'Python'
...   value = 'awesome'
...   def what(self):
...     return "%s is %s!" % (self.name, self.value)
... 

--> dir(Test)
['__class__', '__doc__', '__members__', '__module__', 'name', 'these', 'this', 'value', 'whose']

--> dir(Test.this)
['__class__', '__doc__', '__module__', 'name', 'value', 'what']


--> help(Test)
Help on Test in module __main__ object:

class Test(enum.Enum)
 |  Method resolution order:
 |      Test
 |      enum.Enum
 |      builtins.object
 |  
 |  Data and other attributes defined here:
 |  
 |  these = <Test.these: 'those'>
 |  
 |  this = <Test.this: 'that'>
 |  
 |  whose = <Test.whose: 'mine'>
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from enum.Enum:
 |  
 |  name
 |      The name of the Enum member.
 |  
 |  value
 |      The value of the Enum member.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from enum.EnumMeta:
 |  
 |  __members__
 |      Returns a mapping of member name->value.
 |      
 |      This mapping lists all enum members, including aliases. Note that this
 |      is a read-only view of the internal mapping.
(END)
=======================================================================================

At this point, dir() on an Enum member shows what can be done with the member, and dir() on an Enum class shows what can be done with the class.

I'll create new issues to track changes for inspect and help.
History
Date User Action Args
2013-09-15 23:51:50ethan.furmansetrecipients: + ethan.furman, barry, ronaldoussoren, ned.deily, eli.bendersky, python-dev
2013-09-15 23:51:49ethan.furmansetmessageid: <1379289109.95.0.531818573236.issue18693@psf.upfronthosting.co.za>
2013-09-15 23:51:49ethan.furmanlinkissue18693 messages
2013-09-15 23:51:49ethan.furmancreate