Message320235
I'm certainly in favor of adding a way for infinite iterators to state that they are infinite. I just feel like TypeError is way overused in Python. I also disagree that it's a category error: it's an iterable, so it does make sense to ask for its length.
You should also consider that there may be classes of iterables whose instances are sometimes finite and sometimes infinite. Then it's certainly not a category error.
So I would like a specific answer for "I'm infinite". If you don't like OverflowError, other options are ArithmeticError, IndexError, ValueError or simply returning math.inf |
|
Date |
User |
Action |
Args |
2018-06-22 13:41:01 | jdemeyer | set | recipients:
+ jdemeyer, rhettinger, ncoghlan |
2018-06-22 13:41:01 | jdemeyer | set | messageid: <1529674861.11.0.56676864532.issue33939@psf.upfronthosting.co.za> |
2018-06-22 13:41:01 | jdemeyer | link | issue33939 messages |
2018-06-22 13:41:01 | jdemeyer | create | |
|