Paul Sokolovsky added the comment:
array.array('i', [0]) * 3
@Serhiy Storchaka:
The keyword is efficiently. Let's analyze: this creates useless
array.array('i', [0]) object destined only for garbage collection. Then, it
forces using loop of loops to fill in a new object. Whereas
Paul Sokolovsky added the comment:
@Terry J. Reedy:
Thanks for the pointer. My inital response is sadness, another bloating of
namespace. But I'm adjusting.
But that PEP shows the issue with all that activity: CPython stdlib got so big
and bloated, that it lives its own life and people
Martin v. Löwis added the comment:
Paul: Discussion of the PEP is out of the scope of this issue. The primary
point of the PEP process is that it steers discussion. So if you object to the
PEP, contact the PEP author and ask for your objection to be considered, and if
not that, at least be
Paul Sokolovsky added the comment:
Martin:
People might expect that array.array('i', 3) creates an array with the single
value 3.
I don't know which people would expect that. Personally I recognize the need to
create an empty array of of given size, and have read the docs for builtin
Terry J. Reedy added the comment:
You are proposing to copy behavior that will likely be deprecated and removed
(see http://legacy.python.org/dev/peps/pep-0467/#id5). Lets reject that idea.
The same pep proposes to replace byte(s/array)(n) by two more explicit
alternate constructors
New submission from Paul Sokolovsky:
With bytearray, you can do:
bytearray(3)
bytearray(b'\x00\x00\x00')
However, with arrays:
array.array('i', 3)
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: 'int' object is not iterable
Given that int passed as seconf
Serhiy Storchaka added the comment:
array.array('i', [0]) * 3
array('i', [0, 0, 0])
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21180
___