With Python's cooperative inheritance, I think you want to do everything through one constructor sending keyword arguments up the chain. The keyword arguments are popped off as needed. With this setup I don't think you need "overloaded constructors". Best, Neil On Fri, Feb 13, 2015 at 4:44 AM, Jonas Wielicki <j.wielicki at sotecware.net> wrote: > If I may humbly chime in this, with a hint... > > On 13.02.2015 05:01, Guido van Rossum wrote: > > On Thu, Feb 12, 2015 at 7:41 PM, Ethan Furman <ethan at stoneleaf.us> > wrote: > >> [snip] > >> 2) always use the type of self when creating new instances > >> > >> pros: > >> - subclasses automatically maintain type > >> - much less code in the simple cases [1] > >> > >> cons: > >> - if constructor signatures change, must override all methods which > >> create new objects > >> > >> Unless there are powerful reasons against number 2 (such as performance, > >> or the effort to affect the change), it sure > >> seems like the nicer way to go. > >> > >> So back to my original question: what other concerns are there, and has > >> anybody done any benchmarks? > >> > > > > Con for #2 is a showstopper. Forget about it. > > I would like to mention that there is another language out there which > knows about virtual constructors (virtual like in virtual methods, with > signature match requirements and such), which is FreePascal (and Delphi, > and I think original Object Pascal too). > > It is actually a feature I liked about these languages, compared to > C++03 and others, that constructors could be virtual and that classes > were first-class citizens. > > Of course, Python cannot check the signature at compile time. But I > think as long as it is documented, there should be no reason not to > allow and support it. It really is analogous to other methods which need > to have a matching signature. > > just my two cents, > jwi > > > > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/mistersheik%40gmail.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150213/c5c4dd7a/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4