tqdm/tqdm

Allow providing `OrderedDict` to the option `postfix` in the `tqdm` class

Opened this issue · 0 comments

  • I have marked all applicable categories:
    • documentation request (i.e. "X is missing from the documentation." If instead I want to ask "how to use X?" I understand StackOverflow#tqdm is more appropriate)
    • new feature request
  • I have visited the source website, and in particular
    read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable: 4.66.2 3.10.2 | packaged by conda-forge | (main, Mar 8 2022, 15:53:57) [GCC 9.4.0] linux

Hi!

I've been using tqdm lately along with the set_postfix function. I noticed that in the documentation it says that you can provide not only a dict but also an OrderedDict. The OrderedDict works as expected, but the option postfix in the tqdm class does not work as expected if you provide an OrderedDict (i.e., the order is different from execution to execution, I guess that due to the PYTHONHASHSEED envvar or similar which helps to initialize the dictionaries order). In the documentation we can see that postfix: dict or *, optional, so the documentation is correct (i.e., it doesn't mention OrderedDict). But since for the set_postfix we can see that in the documentation allows dict or OrderedDict, I think that it makes sense that the postfix option of the tqdm class would also accept an OrderedDict to preserve the order of the parameters. I guess that the change shouldn't be too difficult since currently when postfix is provided in the tqdm class, it "calls set_postfix(**postfix)".

Thank you!