[Python-ideas] Add orderedset as set(iterable, *, ordered=False) and similarly for frozenset.

Neil Girdhar mistersheik at gmail.com
Sun Feb 8 01:34:27 CET 2015


You make a good point, but I'm still unfortunately unconvinced.  If it were
called UniqueList, I would agree with you.  Since it's called OrderedSet, I
expect it to use the same operations as set.   Also, typically I implement
something using set and then after the fact realize that I need ordering.
I then change the declaration to OrderedSet.  With your solution, I would
have to also change | and |= to + and +=.  I feel that update should remain
equivalent to |= rather than switching to +=,

Best,

Neil

On Sat, Feb 7, 2015 at 6:24 PM, Ed Kellett <edk141 at gmail.com> wrote:

> On Sat Feb 07 2015 at 11:12:02 PM Neil Girdhar <mistersheik at gmail.com>
> wrote:
>>
>> Why shouldn't that be the same as
>>
>> a | b | c | d
>>
>> ?
>>
>> I think it should and that in general union should be equivalent in
>> effect to copy and extend.
>>
>
> Because yielding an ordering doesn't have any basis in the definition of
> union, and it's not any easier to write than a + b + c + d. "copy and
> extend" is just concatenation - is there any reason *not* to use the
> concatenation operator for it, rather than the union?
>
> Ed Kellett
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150207/636a6234/attachment.html>


More information about the Python-ideas mailing list