[issue19030] Make inspect.getmembers and inspect.classify_class_attrs Enum aware

2013-09-15 Thread Ethan Furman
Ethan Furman added the comment: Here's a crazy idea. :) The only reason the patch is tied to Enum is because of Enum's use of the _RouteClassAttributeToGetattr descriptor. If we had a module similar to functools, say classtools, we could flesh out _RouteClassAttributeToGetattr, rename it to

[issue19030] Make inspect.getmembers and inspect.classify_class_attrs Enum aware

2013-09-15 Thread Ethan Furman
Ethan Furman added the comment: I do not see one. I did post to PyDev asking about dir -- perhaps I should have given it a different title. -- ___ Python tracker ___ __

[issue19030] Make inspect.getmembers and inspect.classify_class_attrs Enum aware

2013-09-15 Thread R. David Murray
R. David Murray added the comment: So the real problem is that inspect depends on dir? Isn't there already a bug open for that issue? -- ___ Python tracker ___

[issue19030] Make inspect.getmembers and inspect.classify_class_attrs Enum aware

2013-09-15 Thread Ethan Furman
Ethan Furman added the comment: R David Murray said: > >Special casing Enum in inspect has a code smell to it. I agree, and I'm certainly open to other options. The flow at this point is: help() --> inspect.classify_class_attrs --> dir() --> Enum.__dir__ Because inspect relies on dir and En

[issue19030] Make inspect.getmembers and inspect.classify_class_attrs Enum aware

2013-09-15 Thread Ethan Furman
Ethan Furman added the comment: Attached patch yields these results: === Help on class Test in module __main__: class Test(enum.Enum) | Method resolution order: | Test | enum.Enum | builtins.

[issue19030] Make inspect.getmembers and inspect.classify_class_attrs Enum aware

2013-09-15 Thread R. David Murray
R. David Murray added the comment: Special casing Enum in inspect has a code smell to it. There may not be a better option, but it sure feels ugly. -- nosy: +r.david.murray ___ Python tracker

[issue19030] Make inspect.getmembers and inspect.classify_class_attrs Enum aware

2013-09-15 Thread Ethan Furman
New submission from Ethan Furman: Due to the odd nature of Enum classes and instances, the normal methods used by inspect.getmembers and inspect.classify_class_attrs are insufficient. By special casing Enum inside those two functions the correct information can be returned. Here is an example