[Python-Dev] Making proxy types easier to write and maintain (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Thu Mar 20 04:49:34 CET 2014


On 20 Mar 2014 10:34, "Steven D'Aprano" <steve at pearwood.info> wrote:

On Wed, Mar 19, 2014 at 11:01:39PM +0100, Antoine Pitrou wrote: > On Thu, 20 Mar 2014 07:54:39 +1000 > Nick Coghlan <ncoghlan at gmail.com> wrote: > > > > Graeme Dumpleton has also subsequently written a library to handle easier > > creation of correct proxy types: https://pypi.python.org/pypi/wrapt > > (is "Graeme" another spelling for "Graham"?) Yes.

> > It isn't as simple as changing one lookup function though - abstract.c > > reads the type slots directly, and those are already hairy performance > > critical code paths (especially the binary operator type dispatch). > > Oh indeed, you're right. I think my proposal is taking water. Nevertheless, I would like to see a standard way to proxy dunder methods.

I had vague plans to bug Graham (yay, spelling!) about proposing wrapt for inclusion in 3.5 (possibly split between functools and types rather than as a completely new module, though).

functools.wraps was always intended as a near term workaround that, like most sufficiently effective workarounds, ended lasting years before its limitations irritated anyone enough for them to go back and do it right :)

Cheers, Nick.

-- Steven


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140320/96677b29/attachment.html>



More information about the Python-Dev mailing list