Feature request: Allow using lambdas in postfix
Bladieblah opened this issue · 0 comments
Bladieblah commented
- 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:import tqdm, sys print(tqdm.__version__, sys.version, sys.platform)
I would like to use lambda functions in postfixes that automatically update attributes, which would give cleaner loops. Instead of
foo = 0
pbar = trange(50, postfix={"foo": foo})
for i in pbar:
foo = i
pbar.set_postfix({"foo": foo})
you could simply write
foo = 0
pbar = trange(50, postfix={"foo": lambda: foo})
for i in pbar:
foo = i
leading to a cleaner inner loop.