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/133872.html below:

[Python-Dev] issue with itertools leads the crash

[Python-Dev] issue with itertools leads the crash [Python-Dev] issue with itertools leads the crashSteven D'Aprano steve at pearwood.info
Thu Apr 10 02:55:01 CEST 2014
On Wed, Apr 09, 2014 at 02:40:21PM -0400, Geoffrey Spear wrote:

> Of course, this raises the question of whether making slice assignment
> not go into an infinite loop when the programmer asks it to is a
> bugfix or a new feature.

Definitely a new feature.

> Calling:
> 
>     list(itertools.cycle([0]))
> 
> exhibits the same behavior for the same reason, and I don't think
> anyone would call that a bug in Python.

It's not a bug, nevertheless it is a problem that can be amiliated. 
Some objects now have a __length_hint__  method. cycle could use that to 
indicate that it was infinitely long, and list could raise an exception 
*before* consuming all available memory.

http://legacy.python.org/dev/peps/pep-0424/


-- 
Steven
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