On Fri, Feb 7, 2020 at 12:02 PM Soni L. <fakedme...@gmail.com> wrote: > > > > On 2020-02-07 1:33 p.m., Nick Timkovich wrote: > > On Fri, Feb 7, 2020 at 10:11 AM Soni L. <fakedme...@gmail.com> wrote: >> >> I'd like to see traits some day, with a syntax similar to this one: >> ... >> if the trait isn't used in the function definition you get the raw >> object, where name conflicts between traits (but not between traits and >> inherent methods) result in an error about name conflicts. otherwise you >> get a friendly wrapper. > > > I assume traits are a feature of another language, but not being familiar > with it can you illustrate its need a bit better? Can you give an example in > current Python, and how it could be made more clear with the notional trait > syntax? > > Nick > > > Hello Nick! > > Traits are an alternative to Multiple Inheritance. They solve the problem of > name conflicts by making them an ambiguity error and requiring you to > disambiguate (at call site).
The examples shown seem to create the very problem you claim traits solve. It is only the introduction of your `impl` keyword in the example that allowed there to be more than one `x()` in the first place. Can you elaborate on why this is even a problem in the first place that would need solved in Python code today? > _______________________________________________ > 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/KFTJ6QRCTICL4NDUURNY35D7JIDM3VWY/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- CALVIN SPEALMAN SENIOR QUALITY ENGINEER cspea...@redhat.com M: +1.336.210.5107 TRIED. TESTED. TRUSTED. _______________________________________________ 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/XFJECACU55QMCRFYWPREG57OFJKPS5BC/ Code of Conduct: http://python.org/psf/codeofconduct/