Open carlocagnetta opened 4 months ago
@MischaPanch even by resetting self.spaces
after initializing the dict space, it will again brake the order when using any ObsWrapper, for example FrameStackObservation
@carlocagnetta Interesting suggestions, similarly I don't like needing to sort the dictionary data as it is a product of technical debt when python dictionaries weren't insertion sorted. I agree, that adding an argument would solve this issue.
Could you make a PR for it?
Sorting the dictionary's entries it's probably not always wanted, but unfortunately there is no way around it other than overwriting
self.spaces
after initializing aspaces.Dict
. It would be handy to make this optional, maybe with default parameter for backwards compatibility if needed.https://github.com/Farama-Foundation/Gymnasium/blame/0607994d37a8079945ed0e0416ff750a3ad2e26f/gymnasium/spaces/dict.py#L73