On Mar 26, 2015, at 21:26, Zaur Shibzukhov <szport@gmail.com> wrote:
2015-03-27 7:08 GMT+03:00 Joonas Liik <liik.joonas@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?

 

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.
 

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/