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 <et...@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




Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to