New submission from Alex Gaynor:

Following the length_hint PEP, we should expose this facility to end-python 
programmers. The semantics would be basically: the list has behavior identical 
to if you hadn't provided length_hint, except the VM is free to preallocate 
efficiently.

CPython (and PyPy) use this kind of logic internally all over the place when 
lists are to be returned (including, but not limited to, list() with a single 
argument!)

If this is considered to be a good idea I'll whip up a patch.

----------
messages: 183332
nosy: alex
priority: normal
severity: normal
status: open
title: Add length_hint parameter to list, dict, set constructors to allow 
efficient presizing
type: performance
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17338>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to