Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporting class Atpbar in __init__.py #29

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Nicolas-Reyland
Copy link

@Nicolas-Reyland Nicolas-Reyland commented Mar 29, 2023

Exporting the Atpbar class, so that progress bars can be created for iterable objects for which one knows then length, but for which the __len__() method is not implemented.

@Nicolas-Reyland
Copy link
Author

Nicolas-Reyland commented Mar 29, 2023

If you wonder about my use case, here is an example: pandas dataframes have many iterators. For example, if you want to iterate over a dataframe using the itertuples method, you find yourself with a valid iterator for which you know the length (df.shape[0]), but which can't be thrown to the atpbar function. What I ended up doing was this:
Atpbar = type(atpbar([1, 2, 3])). And then later: for row_a in Atpbar(a.itertuples(), len_=a.shape[0], ...).

I don't find this very elegant. I am open to suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant