This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年07月22日 18:35 by alex, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg140901 - (view) | Author: Alex Gaynor (alex) * (Python committer) | Date: 2011年07月22日 18:35 | |
From python-ideas: introduce array.zeroes, a new classmethod that provides an alternative constructor, its signature is zeroes(typecode, length), which allows for preallocating an array, with a lower overhead than methods such as array(typecode, [0]) * length, and is more readable (plus consistant with the numpy method of the same name). |
|||
| msg140905 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2011年07月22日 20:55 | |
-1
Array's API much more closely matches that of list than it does numpy's arrays which are profoundly different. So we should stick the one-way-to-do-it idiom: array.array('c', '0円') * 100 or array.array('d', [0.0]) * 100.
Also, the current idiom is much more flexible in that it works with any initializer, not just a zero (compare with numpy's ones() constructor for example).
|
|||
| msg141133 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2011年07月26日 00:43 | |
Compare however the behaviour of bytes() and bytearray() which support direct zero initialisation of a region of memory by passing an integer to their constructor. |
|||
| msg141139 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2011年07月26日 10:23 | |
Array has been around for a very long time and this functionality has never been requested. That and the fact that we already have a way to do it (the same way as for lists) is a strong indication that this isn't needed at all. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:20 | admin | set | github: 56824 |
| 2011年07月26日 10:23:03 | rhettinger | set | status: open -> closed resolution: rejected messages: + msg141139 versions: + Python 3.3, - Python 3.4 |
| 2011年07月26日 01:44:54 | santoso.wijaya | set | nosy:
+ santoso.wijaya |
| 2011年07月26日 00:43:56 | ncoghlan | set | nosy:
+ ncoghlan messages: + msg141133 |
| 2011年07月22日 20:55:15 | rhettinger | set | assignee: alex -> rhettinger messages: + msg140905 nosy: + rhettinger |
| 2011年07月22日 18:35:11 | alex | create | |