[issue21180] Cannot efficiently create empty array.array of given size, inconsistency with bytearray

Paul Sokolovsky report at bugs.python.org
Sun Apr 13 18:17:33 CEST 2014


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 "bytearray" type, and expect extension type array.array to work the same. I'd even say that I found any other expectations ungrounded, in particular, a way to create an array of single int is obviously bytearray([3]) or array.array('i', [3]).

Anyway, as I say in "2014-04-13 15:29" comment, I'm only glad to follow with PEP467 changes. Unfortunately, I don't seem to be able to update initial ticket description with updated proposal.


> array.array('i', len=3)

The whole scope of this ticket is to have consistent API between bytearray and array.array. So, the only way I could suggest (or back) the above is if PEP467 was changed too, and as you suggest, I don't do that. (I personally also dislike overuse of keyword args.)

> In any case, it is unlikely that anything will be done with this issue unless you provide a patch (and that still would be no guarantee that somebody accepts it).

The ending is the saddest. As I mentioned, the best outcome I could imagine of such reports is that people who consider changing builtin types to also consider obvious stdlib counterparts too. (There's another issue - stdlib is indeed enormous, so it would be nice to separate it (speculatively) into ["builtin types/lib"], "core stdlib", and "extended stdlib". There's clear difference between array module and for example unittest or logging.

Thanks for hint re: mailing Nick Coghlan - nice to know that's acceptable, that's certainly easier than figuring out which mailing list to use and then to follow it. (I see that Nick is in noselist of this ticket, but I guess I'll mail him anyway to have my conscience clear that I did everything to make Python better (== more consistent)).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21180>
_______________________________________


More information about the Python-bugs-list mailing list