On Fri., Oct. 11, 2019, 2:38 a.m. Neil Girdhar, <mistersh...@gmail.com>
wrote:

>
>
> On Fri, Oct 11, 2019 at 2:28 AM Andrew Barnert <abarn...@yahoo.com> wrote:
>
>> > On Oct 10, 2019, at 22:13, Neil Girdhar <mistersh...@gmail.com> wrote:
>> >
>> > That's funny, I always thought of that as legacy.  The iterator
>> protocol has been a special case in so many proposals I've seen on this
>> list.  I think it's really ugly.  Instead of
>> collections.abc.OldStyleSequence, what do you think of adding something
>> like InfiniteSequence to collections.abc instead?  It's basically Sequence
>> without __len__, __reversed__, or __count__.   I don't see it getting much
>> use though.
>>
>> Are you proposing that this type isn’t allowed to have those methods (as
>> opposed to just not being required to)?
>
>
> Not required.  Just like if we added a row to the table.  So, the point of
> this mixin would be to implement __contains__ __iter__ and __index__ given
> __getitem__.
>
>
>> If so that would be a unique ABC, and a pretty weird one. If not, isn’t
>> this exactly equivalent to the original proposal, but just with a different
>> name? And I think it’s a pretty misleading name. Especially if the subclass
>> hook is structural (method-check), because then it would pick up Sequence
>> and Mapping types even though they aren’t infinite sequences. For that
>> matter, not even every useful old-style sequence is infinite; that’s just
>> the most obvious example everyone comes up with first.
>>
>
> Yeah, those are all good points.  After sending, I realized, that it would
> be nicer as a base class of Sequence.  I guess I'm for the proposal then.
> I skipped reading the big debate about structural checks because I think if
> you really care about this, you should probably either inherit from the ABC
> or register yourself with it.
>
> Anyway, I guess we pretty much agree then.  I just wanted to push against
> legitimizing the sequence protocol in favor of explicitly inheriting from a
> mixin (whatever you want to call it, GenericSequence?  AbstractSequence?
> PossiblyInfiniteSequence?)   Inheritance like this is a nice declaration of
> intent.  Even if you just implemented __getitem__, I think you would have
> to have a comment to make the code clear anyway.
>
>
>> Anyway, I don’t want to put words in Steven’s mouth; maybe this would fit
>> what he wanted. But I suspect it wouldn’t.
>>
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HNJGWHF3R5AABCNEGE7RRMOQOJ6IV2S7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to