[issue45288] Inspect - Added sort_result parameter on getmembers function.
Cristobal Riaga added the comment: That worked , thank you for your time and answer. I will keep working on PyAPIReference. Also I will close the pull request I created on GitHub. -- ___ Python tracker <https://bugs.python.org/issue45288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45288] Inspect - Added sort_result parameter on getmembers function.
Cristobal Riaga added the comment: I'm don't really need inherit order, neither built-in members. e.g.: ```py a = 3 # First class B: # Second pass def foo(): # Third pass ``` Or in a more complex module: ```py class A: # First pass class B: # Second pass class C(A, B): # Third pass ``` The order should be: - A (class) - B (class) - C (class): inherited from A and B. Here is the link to the script I'm using to inspect a module: https://github.com/Patitotective/PyAPIReference/blob/main/PyAPIReference/inspect_object.py. -- ___ Python tracker <https://bugs.python.org/issue45288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45288] Inspect - Added sort_result parameter on getmembers function.
Cristobal Riaga added the comment: So there is no way to get members in the order you defined them? -- ___ Python tracker <https://bugs.python.org/issue45288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45288] Inspect - Added sort_result parameter on getmembers function.
Cristobal Riaga added the comment: So there is no way to get the members in order? -- ___ Python tracker <https://bugs.python.org/issue45288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45288] Inspect - Added sort_result parameter on getmembers function.
Cristobal Riaga added the comment: Added sort_result parameter (bool=True) on getmembers function inside Lib/inspect.py, that, as it name says, allows you to getmembers result without sorting it. I'm needed of this and it seems impossible to achieve because of 367 line: results.sort(key=lambda pair: pair[0]) Any other solution is very welcomed. (I need it because I'm working on an API Reference creator and I think it would be better if it the members are ordered in the same order you define them.) -- ___ Python tracker <https://bugs.python.org/issue45288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45288] Inspect - Added sort_result parameter on getmembers function.
New submission from Cristobal Riaga : Added `sort_result` parameter (`bool=True`) on `getmembers` function inside `Lib/inspect.py`, that, as it name says, allows you to `getmembers` result without sorting it. I'm needed of this and it seems impossible to achieve because of [`367` line](https://github.com/python/cpython/blob/3.9/Lib/inspect.py#L367): ```py results.sort(key=lambda pair: pair[0]) ``` Any other solution is very welcomed. (I need it because I'm working on an [API Reference creator](https://github.com/Patitotective/PyAPIReference) and I think it would be better if it the members are ordered in the same order you define them.) -- components: Library (Lib) messages: 402626 nosy: Patitotective priority: normal pull_requests: 26947 severity: normal status: open title: Inspect - Added sort_result parameter on getmembers function. versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue45288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com