Text: TypeError: BucketIterator object is not an iterator

Created on 9 Jul 2017  路  3Comments  路  Source: pytorch/text

BucketIterator it be an iterator must also implement the next function.

https://stackoverflow.com/questions/33956034/why-is-an-iterable-object-not-an-iterator

docs

Most helpful comment

This quote is gold "one drawback is that the class name is a lie". :joy:

Is it worth noting this in the documentation?

All 3 comments

This was a design decision that could go either way (I鈥檇 rather not conflate iterable and iterator in the same type, so it should be one or the other); currently, if you need an iterator object, you can call iter() on it.
One benefit of the current approach is that state doesn鈥檛 leak in what could be a confusing way, one drawback is that the class name is a lie...

This quote is gold "one drawback is that the class name is a lie". :joy:

Is it worth noting this in the documentation?

Yes :)

Was this page helpful?
0 / 5 - 0 ratings