[issue45288] Inspect - Added sort_result parameter on getmembers function.

Cristobal Riaga report at bugs.python.org
Sat Sep 25 10:28:24 EDT 2021


New submission from Cristobal Riaga <cristobalriaga at gmail.com>:

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 <report at bugs.python.org>
<https://bugs.python.org/issue45288>
_______________________________________


More information about the Python-bugs-list mailing list