Steven D'Aprano <[email protected]> added the comment:
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
----------
nosy: +steven.daprano
resolution: not a bug ->
stage: resolved -> needs patch
status: closed -> open
type: behavior -> enhancement
versions: +Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32259>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com