This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients agthorr, belopolsky, christian.heimes, gregory.p.smith, pitrou, ronaldoussoren, steven.daprano, stutzbach, tshepang, vajrasky
Date 2013-08-05.15:33:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <51FFC5D3.3040606@pearwood.info>
In-reply-to <1375500120.19.0.896650033196.issue18606@psf.upfronthosting.co.za>
Content
On 03/08/13 13:22, Alexander Belopolsky wrote:
>
> Alexander Belopolsky added the comment:
>
> The implementation of median and mode families of functions as classes is clever,

So long as it is not too clever.

> but I am not sure it is a good idea to return something other than an instance of the class from __new__().

Returning foreign instances is supported behaviour for __new__. (If the object returned from __new__ is not an instance, __init__ is not called.) I believe the current implementation is reasonable and prefer to keep it. If I use the traditional implementation, there will only be one instance, with no state, only methods. That's a rather poor excuse for an instance, and a class already is a singleton object with methods and (in this case) no state, so creating an instance as well adds nothing.

I will change the implementation if the consensus among senior devs is against it, but would prefer not to.
History
Date User Action Args
2013-08-05 15:33:47steven.dapranosetrecipients: + steven.daprano, gregory.p.smith, ronaldoussoren, belopolsky, pitrou, agthorr, christian.heimes, stutzbach, tshepang, vajrasky
2013-08-05 15:33:47steven.dapranolinkissue18606 messages
2013-08-05 15:33:46steven.dapranocreate