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/2012-July/120951.html below:

[Python-Dev] PEP 0424: A method for exposing a length hint

[Python-Dev] PEP 0424: A method for exposing a length hint [Python-Dev] PEP 0424: A method for exposing a length hintSteven D'Aprano steve at pearwood.info
Sun Jul 15 18:39:01 CEST 2012
Steven D'Aprano wrote:

> With a length hint, we could strengthen that promise:
> 
> "if __length_hint__ returns a negative number, list, tuple and set will 
> fail immediately with MemoryError"
> 
> which I think is a good safety feature for some things which cannot 
> possibly succeed, but risk DOSing your system. Does it prevent every 
> possible failure mode? No, of course not. But just because you can't 
> prevent *every* problem doesn't mean you should prevent the ones which 
> you can.

Gah, I messed that last sentence up. It should read:

just because you can't prevent *every* problem doesn't mean you SHOULDN'T 
prevent the ones which you can.


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