You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use the as clause along with the context manager abilities of the Spinner class in order to remember the Spinner object, because I want to temporarily suspend the spinner during a password prompt that may happen while executing the code that has the spinner turned on.
However, that resulted in a value of None in the name specified in the as clause.
For example:
with click_spinner.spinner() as sp:
print(sp)
will print None.
Even if there is not much value currently in having the Spinner object at hand, I think it is part of the contract for a context manager to be able to support the `as´ clause.
Solution: Python uses the return value of the __enter__() method to bind the name specified in the as clause to. So in order to support the as clause, the __enter__() method of the Spinner class needs to return self.
The text was updated successfully, but these errors were encountered:
I was trying to use the
as
clause along with the context manager abilities of theSpinner
class in order to remember the Spinner object, because I want to temporarily suspend the spinner during a password prompt that may happen while executing the code that has the spinner turned on.However, that resulted in a value of
None
in the name specified in theas
clause.For example:
will print
None
.Even if there is not much value currently in having the Spinner object at hand, I think it is part of the contract for a context manager to be able to support the `as´ clause.
Solution: Python uses the return value of the
__enter__()
method to bind the name specified in theas
clause to. So in order to support theas
clause, the__enter__()
method of theSpinner
class needs to returnself
.The text was updated successfully, but these errors were encountered: