For a non-infinite iterator (with a known end target), tqdm or a typical progress bar library can show the progress percentage, e.g.:
20%|### | 200/1000 (00:03<00:09 98.3it/s)
For an infinite iterator, like in the case of this command-line (tqdm is also available as a CLI):
% seq 999999 | tqdm
the progress library could just show something like:
203495 (00:03<00:09 99988.3it/s)
or:
??%| ### | 203495 (00:03<00:09 99988.3it/s)
where the progress bar is just animated with a running ### bar, like you would see in various UI.
A circular iterator wouldn't be problematic, the progress bar would just be reset and start again accordingly. But of course normally the user will not attach a circular iterator if he/she wants to display a progress bar for a process that ends after a certain time.
In reply to Re^4: Porting tqdm to Perl
by perlancar
in thread Porting tqdm to Perl
by perlancar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |