On Mar 27, 2015 5:33 AM, "Andrew Barnert" <abarnert@yahoo.com.dmarc.invalid> wrote:
>
> On Mar 26, 2015, at 21:08, Joonas Liik <liik.joonas@gmail.com> wrote:
>> On 26 March 2015 at 07:17, Zaur Shibzukhov <szport@gmail.com> wrote:
>>>
>>>
>>>
>>> вторник, 17 марта 2015 г., 19:52:28 UTC+3 пользователь Luciano Ramalho написал:
>>>>
>>>> Sometimes we need a simple class to hold some mutable attributes,
>>>> provide a nice repr, support == for testing, and support iterable
>>>> unpacking, so you can write:
>>>>
>>>> >>> p = Point(3, 4)
>>>> >>> x, y = p
>>>>
>>>> That's very much like the classes built by namedtuple, but mutable.
>>>>
>>>> I propose we add to the collections module another class factory. I am
>>>> calling it plainclass, but perhaps we can think of a better name. Here
>>>> is how it would be used:
>>>>
>>>> >>> import collections
>>>> >>> Point = collections.plainclass('Point', 'x y')
>>>>
>>>> The signature of the plainclass function would be exactly the same as
>>>> namedtuple, supporting the same alternative ways of naming the
>>>> attributes.
>>>>
>>>
>>> There is an attempt to make such alternative: recordarray
>
>
> The name "array" seems really unfortunate. It doesn't give you any clue that this thing is halfway between a tuple and a list. Also, we've already got a bytearray, array.array, and the NumPy array types, all of which hold homogeneous simple-value types and can be accessed as buffers. And bytearray and array.array are resizable. And np.ndarray--like a C array, in effect--returns views when sliced rather than copies. Just about everything this name implies is misleading.
>
> And as for recordarray, that doesn't exactly scream "like a namedtuple, but with array instead of tuple".

Numpy already has the concept of a "record array", which they call "recarray", which is a numpy array that is partially accessible in a similar manner to named tuples. However, otherwise they are the same as numpy arrays, which means they have a fixed size (usually) but mutable contents.

Whether you consider this a point in favor or a point against, however, probably depends on your point of view.