On Tue, Aug 25, 2020 at 10:51 AM Alex Hall <alex.moj...@gmail.com> wrote:
> On Tue, Aug 25, 2020 at 7:23 PM Christopher Barker > I think if it's a potential problem to add it to the ABC then let's just > defer that and only add it to the built in sequences. > Well yes, that’s a fine solution. Though an advantage of adding it into the ABC is that it could be a mixin, and all Sequences would them get it. But I'm not clear on what the problem is. If you have some code like this: > > ``` > class MySequence(Sequence): > def get(self, i): ... > > MySequence().get(3) > ``` > > and then add .get to the Sequence ABC, the existing code will not be > immediately broken because the custom MySequence.get overrides the ABC > method so everything behaves as before. > Yes, but then the third party object that was a Sequence may no longer be one. Maybe if we build up enough methods to add to the collection ABCs > (Sequence.view, Sequence.get, Set.intersection/union/etc, > Mapping.__[i]or__) we can justify adding them all at once in Python 4 > Careful now! No one wants to repeat the py2/3 transition! or in a new module collections.abc.v2 which has subclasses of the originals. > Maybe, but the trick is: how do you “build up” thus stuff before you have a place to put it? And what’s the point of a place to put new stuff, when there isn’t any new stuff? -CHB > -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ 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/R3RIGL247UNOMSQ3RYJGAK32MOIDX5CO/ Code of Conduct: http://python.org/psf/codeofconduct/