Christopher Barker wrote: ... > > Perhaps the OP wanted the internal array size initialized, but not used. > Currently the internal array will automatically be reallocated to grow as > needed. Which could be a performance hit if you know it’s going to grow > large. > But frankly, it would be a rare case where this would be noticeable. > -CHB
Maybe uncommon, but I don't know about rare. Let's say you want to perform list-wise computations, making new lists with results of operations on existing lists (similar to numpy, but maybe trying to do something numpy is unsuitable for)? You would want to pre-allocate the new array to the size of the operand arrays. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/2A2LOYFPBGGMOJGRLPTSLU6MSBWJPKV4/ Code of Conduct: http://python.org/psf/codeofconduct/