Message307937
I agree with Camion that the error message is misleading, and not just for beginners. It threw me for a loop too, when I first read it.
Serhiy is right, the exception type cannot and should not be changed, but we can change the error message. I'm re-opening the ticket as an enhancement to improve the message.
Here's my suggestion:
TypeError: cannot unpack object ('Fraction' is not iterable)
There is no stability guarantees on error messages, so we can include it in 3.6 (and possibly older if desired).
By the way Camion, as interesting as your program to calculate the digits of pi is, in general it is better to cut the code down to the simplest version that demonstrates the problem. Something like this would demonstrate it equally as well:
def gen():
yield 1
for x, y in gen():
pass |
|
Date |
User |
Action |
Args |
2017-12-10 01:31:49 | steven.daprano | set | recipients:
+ steven.daprano, eric.smith, serhiy.storchaka, Camion |
2017-12-10 01:31:49 | steven.daprano | set | messageid: <1512869509.79.0.213398074469.issue32259@psf.upfronthosting.co.za> |
2017-12-10 01:31:49 | steven.daprano | link | issue32259 messages |
2017-12-10 01:31:48 | steven.daprano | create | |
|