A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-April/133845.html below:

[Python-Dev] issue with itertools leads the crash

[Python-Dev] issue with itertools leads the crashChris Angelico rosuav at gmail.com
Tue Apr 8 18:50:14 CEST 2014
On Wed, Apr 9, 2014 at 2:40 AM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> On Apr 8, 2014 10:31 AM, "MRAB" <python at mrabarnett.plus.com> wrote:
>> If the RHS yields too few, e.g. 3, you'll get:
>>
>> ValueError: attempt to assign sequence of size 3 to extended slice of size 4
>>
>> If it yields too many, e.g. 10, you'll get:
>>
>> ValueError: attempt to assign sequence of size 10 to extended slice of size 4
> [snip]
>> The fix would be to complain of raise StopIteration doesn't occur after
>> N+1 yields, where N is the number of values needed by the LHS.
>
> Perhaps N+2 would be better:
>
>   raise RuntimeError('{} is right out'.format(n+2))

It would be nice to have a simple notation that fetches what it needs
and ignores any extras.

a, b, c, * = x.split("-")

Bomb if there aren't two hyphens in x, but if there are more, just
take the first three and ignore the rest. Would work with infinite
iterators quite happily.

ChrisA
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4