[Python-ideas] A mutable alternative to namedtuple: recordarray -> recordclass:
Zaur Shibzukhov
szport at gmail.com
Fri Mar 27 18:57:28 CET 2015
---
*Zaur Shibzukhov*
2015-03-27 16:17 GMT+03:00 Zaur Shibzukhov <szport at gmail.com>:
>
>
> ---
> *Zaur Shibzukhov*
>
>
> 2015-03-27 7:40 GMT+03:00 Andrew Barnert <abarnert at yahoo.com>:
>
>> On Mar 26, 2015, at 21:26, Zaur Shibzukhov <szport at gmail.com> wrote:
>>
>> 2015-03-27 7:08 GMT+03:00 Joonas Liik <liik.joonas at gmail.com>:
>>
>>> namedlist perhaps? :)
>>>
>>> if you want:"namedtuple, but mutable. " then namedlist seems like the
>>> obvious alternative..
>>>
>>
>> The name 'namedlist' is already used in
>> https://pypi.python.org/pypi/namedlist, 'mutabletuple' -- too in
>> https://pypi.python.org/pypi/mutabletuple.
>>
>>
>> If you're trying to provide the same concept, why use a completely
>> unrelated name? That's like saying 'I want an ordered set, but there's
>> already an "orderedset" on PyPI so I went with "sortedsequence"'.
>>
>> The name recordarray is means that it 1) array of objects and 2) record
>> with access to fields by attributes.
>>
>>
>> But how is being "an array of objects" any different from what a tuple,
>> list, array.array, bytearray, bytes, str, etc. already are? What's
>> specifically array-like about this type as opposed to all of those? And
>> what's specifically record-like about your type compared to namedtuple,
>> Struct, or SimpleNamespace?
>>
>>
> I am inclined to the fact that it's better to rename `objectarray` to
> 'mutabletuple' in order to be explicit about what is that.
> 'recordarray' is a factory function that make exactly the same as
> 'namedtuple' factory does (except that it create subclass of 'mutabletuple'
> and make '_replace' to update the 'self', not make a copy). So may be it's
> better to call it as 'record' or 'recordtype', or even 'recordfactory'?
>
>
After consideration of all arguments recordarray project was renamed tand
moved to recordclass <https://pypi.python.org/pypi/recordclass>.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150327/96f1f8c4/attachment.html>
More information about the Python-ideas
mailing list