On 4/1/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > [Monkeypatching] may just be impossible for ``classes'' that > are actually types implemented in C, as is the case for gmpy.
> ... Rather, look (e.g.) at copy_reg for the typical kludge > that's used to reimplement that crucial design pattern > that is adaptation, over and over and over again. Right -- as an implementation issue, monkeypatching an extension class is ugly, and requires cooperation from the caller. As I see it, there are three possibilities for adaptation: (1) The callee helps explicitly. (In which case, why not just do it directly?) (2) The caller helps explicitly. This is the equivalent of the copy_reg hack. (Except that there might be single registry for all adaptations, instead of separate ones for each piece of functionality. Is that really the key advantage you're looking for?) (3) Neither the callee nor the caller has to change; if there are problems, the system knows to check a system registry for 3rd-party adaptors. This is the (less efficient) equivalent of opening all classes to monkeypatching. (As you mention, this is what Ruby does, but would be a big change for python.) -jJ _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com