Skip to content

Commit

Permalink
basic support for length_hint
Browse files Browse the repository at this point in the history
- fixes #1068
  • Loading branch information
casperdcl committed Mar 5, 2021
1 parent 8830eb5 commit 4ff7753
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tqdm/std.py
Expand Up @@ -1125,6 +1125,8 @@ def __len__(self):
return self.total if self.iterable is None else \
(self.iterable.shape[0] if hasattr(self.iterable, "shape")
else len(self.iterable) if hasattr(self.iterable, "__len__")
else self.iterable.__length_hint__()
if hasattr(self.iterable, "__length_hint__")
else getattr(self, "total", None))

def __enter__(self):
Expand Down

0 comments on commit 4ff7753

Please sign in to comment.