Author gvanrossum
Recipients
Date 2007-03-19.20:01:43
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I'll try to explain why I did it this way.  I was considering the single inheritance case implementing an Immutable object, which overrides __new__ but has no need to override __init__ (since it's too late to do anything in __init__ for an Immutable object).  Since the __init__ still gets called it would be annoying to have to override it just to make the error go away if there was a check in __init__.  The other case is overriding __init__ without overriding __new__, which is the most common way of doing Mutable objects; here you wouldn't want __new__ to complain about extra args.  So the only time when you'd want complaints is if both __new__ and __init__ are the defaults, in which case it doesn't really matter whether you implement this in __init__ or in __new__, so I arbitrarily chose __new__.

I wasn't thinking of your use case at the time though (cooperative super calls to __init__, which still isn't something I engage in on a day-to-day basis).  I wonder if the right thing to do wouldn't be to implement the same check both in __init__ and in __new__.

Am I makign sense?
History
Date User Action Args
2007-08-23 14:52:35adminlinkissue1683368 messages
2007-08-23 14:52:35admincreate