Author eric.snow
Recipients eric.snow
Date 2019-12-17.16:21:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
types.SimpleNamespace was added in 3.3 (for use in sys.implementation; see PEP 421), which predates the change to preserving insertion order in dict.  At the time we chose to sort the attributes in the repr, both for ease of reading and for a consistent output.

The question is, should SimpleNamespace stay as it is (sorted repr) or should it show the order in which attributes were added?

On the one hand, alphabetical order can be useful since it makes it easier for readers to find attributes, especially when there are many.  However, for other cases it is helpful for the repr to show the order in which attributes were added.

FWIW, I favor changing the ordering in the repr to insertion-order.  Either is relatively trivial to get after the fact (whether "sorted(vars(ns))" or "list(vars(ns))"), so I don't think any folks that benefit from alphabetical order will be seriously impacted.
Date User Action Args
2019-12-17 16:21:21eric.snowsetrecipients: + eric.snow
2019-12-17 16:21:21eric.snowsetmessageid: <>
2019-12-17 16:21:21eric.snowlinkissue39075 messages
2019-12-17 16:21:20eric.snowcreate