Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42728
| From | Rotwang <sg552@hotmail.co.uk> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Decorating functions without losing their signatures |
| Date | 2013-04-04 03:17 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <kjino8$frs$1@dont-email.me> (permalink) |
| References | <kjfv4f$4g1$1@dont-email.me> <af2acd0c-c77d-49d3-bc49-a8ba4d0b6a1e@googlegroups.com> |
On 04/04/2013 02:18, Michele Simionato wrote: > On Wednesday, April 3, 2013 3:05:31 AM UTC+2, Rotwang wrote: >> After thinking about it for a while I've come up with the following >> >> abomination > > Alas, there is actually no good way to implement this feature in pure > Python without abominations. Internally the decorator module does > something similar to what you are doing. However, instead of cooking up > yourself your custom solution, it is probably better if you stick to > the decorator module which has been used in production for several > years and has hundreds of thousands of downloads. I am not claiming > that it is bug free, but it is stable, bug reports come very rarely and > it works for all versions of Python from 2.5 to 3.3. Thanks, I'll check it out. Looking at the link Steven provided, I didn't see an easy way to add additional keyword-only arguments to a function's signature, though (but then I've yet to figure out how the FunctionMaker class works).
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Decorating functions without losing their signatures Rotwang <sg552@hotmail.co.uk> - 2013-04-03 02:05 +0100
Re: Decorating functions without losing their signatures Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-03 04:15 +0000
Re: Decorating functions without losing their signatures Rotwang <sg552@hotmail.co.uk> - 2013-04-04 02:53 +0100
Re: Decorating functions without losing their signatures Jan Riechers <janpeterr@freenet.de> - 2013-04-03 08:06 +0300
Re: Decorating functions without losing their signatures Michele Simionato <michele.simionato@gmail.com> - 2013-04-03 18:18 -0700
Re: Decorating functions without losing their signatures Rotwang <sg552@hotmail.co.uk> - 2013-04-04 03:17 +0100
Re: Decorating functions without losing their signatures Rotwang <sg552@hotmail.co.uk> - 2013-04-04 02:44 +0100
csiph-web