On Fri, Feb 13, 2015 at 12:46 PM, MRAB <pyt...@mrabarnett.plus.com> wrote:
>>>> class BaseInt:
> ...     def __init__(self, value):
> ...         self._value = value
> ...     def __add__(self, other):
> ...         return type(self)(self._value + other)

On Fri, Feb 13, 2015 at 11:55 AM, Guido van Rossum <gu...@python.org> wrote:
> ... there is no reason (in general) why
> the signature of a subclass constructor should match the base class
> constructor, and it often doesn't.

You're requiring that any subclass of BaseInt be instantiable with one
argument, namely its value. That's requiring that the signature of the
subclass constructor match the base class constructor.

ChrisA
_______________________________________________
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