On Sat, May 9, 2020 at 8:09 PM Alex Hall <alex.moj...@gmail.com> wrote:

> On Sat, May 9, 2020 at 7:02 PM Ram Rachum <r...@rachum.com> wrote:
>
>>
>> Besides elegance, the above code can be optimized with short-circuit
>> logic for the TooManyToUnpackError, assuming that doesn't break backward
>> compatibility.
>>
>
> The elegance argument doesn't convince me, you'll need to explain what you
> mean by the last bit about short-circuit logic.
>

Ah, I did a test and saw that Python does do that optimization! I meant,
that if there are too many values to unpack, we stop hitting the iterator
after we surpassed the number of items by 1, rather than consume the whole
thing. That is not true about the second example.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/BRF7EUTYZAW6SMEHW5MLSB524CVTUYZF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to