[issue45535] Enum's dir() does not contain inherited members

2022-01-18 Thread Ethan Furman
Ethan Furman added the comment: New changeset 7c0914d35eaaab2f323260ba5fe8884732533888 by Ethan Furman in branch 'main': bpo-45535: [Enum] include special dunders in dir() (GH-30677) https://github.com/python/cpython/commit/7c0914d35eaaab2f323260ba5fe8884732533888 --

[issue45535] Enum's dir() does not contain inherited members

2022-01-18 Thread Ethan Furman
Change by Ethan Furman : -- pull_requests: +28877 pull_request: https://github.com/python/cpython/pull/30677 ___ Python tracker ___

[issue45535] Enum's dir() does not contain inherited members

2022-01-17 Thread Ethan Furman
Ethan Furman added the comment: Fixed in 3.11. Pure enums have a few more dir() entries now; mixed enums now show all inherited methods/attributes -- members still do not show up in member dirs (this is a good thing). -- resolution: -> fixed stage: patch review -> resolved status:

[issue45535] Enum's dir() does not contain inherited members

2021-12-02 Thread Ethan Furman
Ethan Furman added the comment: New changeset b2afdc95cc8f4e9228148730949a43cef0323f15 by Alex Waygood in branch 'main': bpo-45535: Improve output of Enum ``dir()`` (GH-29316) https://github.com/python/cpython/commit/b2afdc95cc8f4e9228148730949a43cef0323f15 --

[issue45535] Enum's dir() does not contain inherited members

2021-10-29 Thread Alex Waygood
Alex Waygood added the comment: I would argue it's quite important for `IntEnum` to have the dunder methods inherited from `int` show up in `help()`. Dunder methods indicate that an object has certain behaviours, so it's important for a user to be able to verify that an `IntEnum` member has

[issue45535] Enum's dir() does not contain inherited members

2021-10-29 Thread Ethan Furman
Ethan Furman added the comment: Enums have had a custom dir() from the beginning, partly because they are not standard objects and do not follow standard rules. The question posed by this issue is whether Enums with mixed-in data types should show the inherited methods, and if yes, should

[issue45535] Enum's dir() does not contain inherited members

2021-10-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 29316 looks complicated. First of all, why do Enum needs a custom __dir__? What is wrong with the default implementation? -- ___ Python tracker

[issue45535] Enum's dir() does not contain inherited members

2021-10-29 Thread Alex Waygood
Change by Alex Waygood : -- keywords: +patch pull_requests: +27585 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29316 ___ Python tracker ___

[issue45535] Enum's dir() does not contain inherited members

2021-10-22 Thread Alex Waygood
Alex Waygood added the comment: Would there be interest in me submitting a PR along these lines? > why use mro() instead of __mro__? Er, no reason, really. To be honest, I've never really understood why Python has both. -- ___ Python

[issue45535] Enum's dir() does not contain inherited members

2021-10-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There may be a simple error (superfluous .__class__), but I am not sure. BTW, why use mro() instead of __mro__? Most code use __mro__. -- ___ Python tracker

[issue45535] Enum's dir() does not contain inherited members

2021-10-21 Thread Ethan Furman
Change by Ethan Furman : -- assignee: -> ethan.furman versions: -Python 3.9 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue45535] Enum's dir() does not contain inherited members

2021-10-21 Thread Ethan Furman
Ethan Furman added the comment: Looks interesting, thank you for the patch. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue45535] Enum's dir() does not contain inherited members

2021-10-21 Thread Alex Waygood
Change by Alex Waygood : Added file: https://bugs.python.org/file50383/enum_dir_output_with_patch.txt ___ Python tracker ___ ___

[issue45535] Enum's dir() does not contain inherited members

2021-10-21 Thread Alex Waygood
Alex Waygood added the comment: I had a go at writing a patch for `__dir__` that would include any methods an enum class had acquired through `int`/`str`/etc. mixins, while continuing to ignore enum dunders and sunders (as is currently the case). My patch also allows user-defined methods

[issue45535] Enum's dir() does not contain inherited members

2021-10-20 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : For example: >>> from enum import * >>> class E(IntEnum): ... x = 1 ... >>> dir(E) ['__class__', '__doc__', '__members__', '__module__', 'x'] >>> E.from_bytes >>> E.to_bytes >>> E.numerator >>> E.__add__ There are methods and attributes