On Mon, Dec 28, 2020 at 8:52 PM Phil Thompson <p...@riverbankcomputing.com> wrote: > > > I would have thought that an object was defined by its behaviour rather > than by any particular implementation detail. >
As my understanding, the policy "an object was defined by its behavior..." doesn't mean "put unlimited amount of implementation behind one concrete type." The policy means APIs shouldn't limit input to one concrete type without a reason. In other words, duck typing and structural subtyping are good. For example, we can try making io.TextIOWrapper accepts not only Unicode objects (including subclass) but any objects implementing some protocol. We already have __index__ for integers and buffer protocol for byts-like objects. That is examples of the policy. Regards, -- Inada Naoki <songofaca...@gmail.com> _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/E3ZMFJDYKDCFPA4ROESPK6T4JPYQMTLU/ Code of Conduct: http://python.org/psf/codeofconduct/