Message315006
The list() constructor isn't taking full advantage of known input lengths or length hints. Ideally, it should pre-size and not over-allocate when the input size is known or can be reasonably estimated. Python 3.8.0a0 (heads/master:091e95e900, Apr 5 2018, 09:48:33) [Clang 9.1.0 (clang-902.0.39.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from sys import getsizeof >>> getsizeof([0] * 10) 144 >>> getsizeof(list([0] * 10)) 200 >>> getsizeof(list(range(10))) 200 | |
Date | User | Action | Args | 2018-04-05 21:46:53 | rhettinger | set | recipients: + rhettinger | 2018-04-05 21:46:53 | rhettinger | set | messageid: <1522964813.15.0.682650639539.issue33234@psf.upfronthosting.co.za> | 2018-04-05 21:46:53 | rhettinger | link | issue33234 messages | 2018-04-05 21:46:53 | rhettinger | create | | |