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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to