Steven D'Aprano added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18606> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com