Ethan Furman added the comment:
Ram asked:
-
> Also, aren't you excluding a lot of important magic methods from that `dir`?
Ethan replied:
-
> We decided the dunder methods were not interesting, so declined to include
> them in the listing. And no, we are not changing our
Ram Rachum added the comment:
Thanks for the fix Ethan. Will you also push this to the backport on PyPI?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
Ethan Furman added the comment:
Thanks for the reminder!
...
Done.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
___
Ram Rachum added the comment:
Thanks!
Two questions:
1. Is there a GitHub repo for enum34? Couldn't find a link to it on the PyPI
page.
2. Aren't 'name' and 'value' already included in `added_behavior`?
--
___
Python tracker
Ram Rachum added the comment:
Also, aren't you excluding a lot of important magic methods from that `dir`?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
Ethan Furman added the comment:
1. Is there a GitHub repo for enum34? Couldn't find a link to it on the PyPI
page.
The repo is at: https://bitbucket.org/stoneleaf/enum34
2. Aren't 'name' and 'value' already included in `added_behavior`?
They didn't used to be, but they are now. I'll
Roundup Robot added the comment:
New changeset 9038b63dad52 by Ethan Furman in branch 'default':
Issue22506: remove name value from __dir__ as they now show up automatically
https://hg.python.org/cpython/rev/9038b63dad52
--
___
Python tracker
Roundup Robot added the comment:
New changeset cd2ede7f2ff5 by Ethan Furman in branch '3.4':
Issue22506: added methods on base Enum class now show up in dir of Enum
subclass (3.4)
https://hg.python.org/cpython/rev/cd2ede7f2ff5
New changeset 424fbf011176 by Ethan Furman in branch 'default':
Changes by Ethan Furman et...@stoneleaf.us:
--
assignee: - ethan.furman
resolution: - fixed
stage: test needed - resolved
status: open - closed
versions: +Python 3.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
Ethan Furman added the comment:
Sample code:
class AutoEnum(enum.Enum):
Automatically numbers enum members starting from 1.
Includes support for a custom docstring per member.
__last_number__
Ram Rachum added the comment:
Ethan: I'm very confused by your example. `huh` isn't even a method, why would
it be included? Or are you saying if it was a method? I'm really not sure
what your example is adding over mine, given that it's 10 times longer and more
complex. I'm not sure why
Ethan Furman added the comment:
Yes, the 'huh' function would have to be in either AutoEnum or AddressSegment
to be included in the dir of an AddressSegment member.
Here's a shorter example:
(this works)
class SuperEnum(Enum):
pass
New submission from Ram Rachum:
Calling `dir` on an enum subclass shows only the contents of that class, not
its parent classes. In normal classes, you can do this:
Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64
bit (AMD64)] on win32
Type help, copyright,
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
___
Python-bugs-list
Changes by Ethan Furman et...@stoneleaf.us:
--
stage: - test needed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
___
Python-bugs-list
Ram Rachum added the comment:
Ethan, I saw you just marked this as test needed. I just gave you code to
reproduce this problem. Isn't that sufficient? Or you want me to do add it to
Python's test suite?
--
___
Python tracker rep...@bugs.python.org
Ethan Furman added the comment:
More just a note to myself to research this further, to see exactly what does
and does not get inherited. Any tests added will likely be more comprehensive
than your example.
--
___
Python tracker
17 matches
Mail list logo