Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upMake identifiers sorting optional #23
Comments
This comment has been minimized.
This comment has been minimized.
|
Certainly! What approach were you going to go about it? I think I'd prefer the flag passed to methods (e.g. |
kernc
changed the title
Making sorting optional
Make identifiers sorting optional
Feb 6, 2019
kernc
added
the
enhancement
label
Feb 6, 2019
This comment has been minimized.
This comment has been minimized.
|
That makes sense to me, thanks for the input! |
This comment has been minimized.
This comment has been minimized.
|
Unfortunately this will not be trivial, as |
This comment has been minimized.
This comment has been minimized.
|
In CPython 3.6+ (Python 3.7+), traversing .__dict__ should retain definition order (?). This shouldn't be a problem since we filter "own" members anyway: Lines 1134 to 1139 in c423762 |
This comment has been minimized.
This comment has been minimized.
|
Right but the issue is that the inspect module already sorts items before returning them so the initial order is already lost by the time this code executes. |
This comment has been minimized.
This comment has been minimized.
|
I thought you were intent on changing this code. We can iterate over |
This comment has been minimized.
This comment has been minimized.
|
Ah gotcha. I wasn’t sure how deep you were OK with me going in terms of these modifications :) should I aim to remove the use of inspect altogether? |
This comment has been minimized.
This comment has been minimized.
|
You just make it work. But altogether no. |
nicolaskruchten commentedFeb 5, 2019
Would you accept a PR to make sorting optional in the documentation (new CLI arg, defaulting to current behaviour)? I rather like the order in which the functions/methods are declared in my module and I'd rather the documentation follow that order rather than a strictly alphabetical one :)