[Python-Dev] PEP 0424: A method for exposing a length hint
Steven D'Aprano
steve at pearwood.info
Sun Jul 15 18:39:01 CEST 2012
More information about the Python-Dev mailing list
Sun Jul 15 18:39:01 CEST 2012
- Previous message: [Python-Dev] PEP 0424: A method for exposing a length hint
- Next message: [Python-Dev] PEP 0424: A method for exposing a length hint
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] PEP 0424: A method for exposing a length hint
- Next message: [Python-Dev] PEP 0424: A method for exposing a length hint
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list