-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
need-feedback 📢We need your response (question)We need your response (question)p3-enhancement 🔥Much new such featureMuch new such feature
Description
If I convert a tqdm object to boolean to test for existence, I get an AttributeError if it was created with disable=True
. Instead I would expect it to evaluate to False.
In [3]: pbar = tqdm(disable=False, total=100)
0%| | 0/100 [00:00<?, ?it/s]
In [4]: bool(pbar)
Out[4]: True
In [5]: pbar = tqdm(disable=True, total=100)
In [6]: bool(pbar)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-da3b9c36e33c> in <module>()
----> 1 bool(pbar)
~/prog/vopu/lib/python3.5/site-packages/tqdm/_tqdm.py in __len__(self)
867
868 def __len__(self):
--> 869 return self.total if self.iterable is None else \
870 (self.iterable.shape[0] if hasattr(self.iterable, "shape")
871 else len(self.iterable) if hasattr(self.iterable, "__len__")
AttributeError: 'tqdm' object has no attribute 'total'
In [7]: print(tqdm.__version__, sys.version, sys.platform)
4.23.4 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] linux
- 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)
Metadata
Metadata
Assignees
Labels
need-feedback 📢We need your response (question)We need your response (question)p3-enhancement 🔥Much new such featureMuch new such feature