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
Outdated documentation for Spinner #11004
Comments
I'm on it |
So. If we make the spinner iterable, It doesn't have a stop condition. So if the user decides to make an adventerous loop (like below) we will not go to space today
Perhaps it's better to just rewrite the generator into an update() function (while leaving the |
That's a good point and exposes another inconsistency between That said, your for loop example is still useful (though it would also be used with a with Spinner('message') as spin:
for _ in spin:
# do stuff
break This is equivalent to having a Meanwhile having an Basically this would be matter of:
|
I swear this issue is cursed. |
…te_spinner_keep_enum Update Spinner API, fix #11004
Description
The current docstring in the Spinner class demonstrates using
s.next()
to update the spinner. But this is a Python 2-ism that no longer exists for iterators in Python 3. Instead the correct documentation would benext(s)
.Additionally, I think it's confusing that the API for
Spinner
is so different fromProgressBar
andProgressBarOrSpinner
. In the latter two cases, their__enter__
method (when usingwith ProgressBar(...) as bar:
returns theProgressBar(OrSpinner)
instance itself, which is iterable itself. It also provides anupdate()
method which can be called to update the progress bar. Whereaswith Spinner(...) as s:
does not return theSpinner
instance itself, but rather a generator.It should be easy to update the API for
Spinner
(make it iterable, make__enter__
return theSpinner
instance, and add anupdate()
method) so that it is more likeProgressBar
.I would suggest making the updates to
Spinner
and fixing the documentation at the same time.The text was updated successfully, but these errors were encountered: