Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83841
| Path | csiph.com!usenet.pasdenom.info!news.franciliens.net!fdn.fr!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <fomcl@yahoo.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'args': 0.07; 'caller': 0.09; 'decorator': 0.09; 'deprecated': 0.09; 'used.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; "'%s": 0.16; '**kwargs)': 0.16; '**kwargs):': 0.16; '*args': 0.16; 'meanwhile': 0.16; 'merci': 0.16; 'parameters,': 0.16; 'positional': 0.16; 'subject:based': 0.16; 'subject:class': 0.16; 'solution.': 0.20; 'example': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'package.': 0.24; 'simpler': 0.24; 'cc:2**0': 0.24; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'especially': 0.30; "i'm": 0.30; 'code': 0.31; '13,': 0.31; 'class': 0.32; 'skip:c 30': 0.32; '-----': 0.33; 'problem': 0.35; 'really': 0.36; 'keyword': 0.36; 'thanks': 0.36; 'hi,': 0.36; 'january': 0.37; 'thank': 0.38; 'version,': 0.38; 'subject:': 0.39; 'how': 0.40; 'received:67.195': 0.60; 'received:98.137': 0.60; 'solve': 0.60; "you've": 0.63; 'hearing': 0.63; 'name': 0.63; 're:': 0.63; 'header:Reply-To:1': 0.67; 'received:gq1.yahoo.com': 0.68; 'received:mail.gq1.yahoo.com': 0.68; '2015': 0.84; 'again!': 0.84; 'received:bullet.mail.gq1.yahoo.com': 0.84; 'mean.': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1421356202; bh=obMnu7/PTXlIkkog8C7no5X4H2pCTlzQ3quntl9PQ9U=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=cyIzjTTkn4iUn4nN8tQuzfVE37nwPJ2KAmjxY326u8SIQU07+ksRryWvqWilB/CXaYdzICqo2ERedRCEJCKNMVAL/sNqaAflbji8fL2gZXMVctdGrORLA2RXI/iEx9rjsoGRrARMz1EDc5Kf4LmdHiqDDmDcJHDNBsSz6DmL1O0MFPI6HbHMYhQ0ArCp1RHQs2l4cE4w+ZzJP8Si+bN66mBhL1H3gcyml3QIkL8B8OnNPxLzmLs+ymg+BifGa+uKcfYDrA4pgWIoSvu55U0lwnc2P4+HSEimklhf7YzhOB0m5kO81xHP2+iJ4cPJ4fEYZolCPorJ48h1UtXcCwE1AQ== |
| X-Yahoo-Newman-Property | ymail-4 |
| X-Yahoo-Newman-Id | 341593.5775.bm@omp1001.mail.gq1.yahoo.com |
| X-YMail-OSG | sDZIO04VM1k.7robktgXYO9hxOslZZLNVhjyJ._CSDvLDpHnDU9yseF0M1rJ_I0 AbwlO.uPue6qrwIOLzPQg8UmlN6XdPmHlyClJGakdjDdh5jaEIZZ6Si2gN7EKHdXPmWw4r32KjWl 25hwNXKXI8wRI4dRHPXoN1vLhM1EzKHsDO1v_DTZyiNxFpLHt.aNmrScGt_Vxjmf0Qi3x2OGXjo4 Q0D8fZ28Y9.JpWmZkmFCKqyKVQdJqO8oHXkrQoaSV.tX4euqoZdn0REYiD7esHPQ_1rrAyUNGxDr gOXaGOlhyhhejug5zqVXeMdk9CsA9OgbgBLYjkgRH6_0S1t19seoJ1B22yAMhqC_on39tqoSMR8C Dsc1TM824LmLv4KLGRsON69QYA5mF5kDrHonhJnR_VxzkH1CNhDLnhpfvIygLItaDCl38ihcC0sb E4_iZW.Y.cNRIQG5gHv.fYvV5EG_6Dx0eCsl1z1QDCdS.3A8TEv48mKgrurLJJCnzeKdqS9uI416 ktsCgp5c0ggKWP_1Y |
| Date | Thu, 15 Jan 2015 21:07:09 +0000 (UTC) |
| From | Albert-Jan Roskam <fomcl@yahoo.com> |
| To | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| In-Reply-To | <41960019.9418586.1421167045799.JavaMail.root@sequans.com> |
| References | <41960019.9418586.1421167045799.JavaMail.root@sequans.com> |
| Subject | Re: class-based class decorator |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| Cc | Python <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | Albert-Jan Roskam <fomcl@yahoo.com> |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17773.1421356398.18130.python-list@python.org> (permalink) |
| Lines | 58 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1421356398 news.xs4all.nl 2894 [2001:888:2000:d::a6]:60153 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:83841 |
Show key headers only | View raw
----- Original Message ----- > From: Jean-Michel Pichavant <jeanmichel@sequans.com> > To: Albert-Jan Roskam <fomcl@yahoo.com> > Cc: Python <python-list@python.org> > Sent: Tuesday, January 13, 2015 5:37 PM > Subject: Re: class-based class decorator > > ----- Original Message ----- >> From: "Albert-Jan Roskam" <fomcl@yahoo.com> >> > From: Jean-Michel Pichavant <jeanmichel@sequans.com> >> > I don't really understand how you successfuly manage positional >> > parameters, >> > since the caller may not name them. >> > I'm asking because if your intend to check only the keyword >> > parameters, >> > there's a much simplier solution. >> > >> > JM >> >> >> Hi, >> >> Can you give an example of where/how my code would fail? I do not >> intend to use *args and **kwargs, if that is what you mean. I am >> interested in hearing a simpler approach, especially if it would >> also solve the messed-up-signature problem that I mentioned. >> >> Thank you! >> >> Albert-Jan >> > > In the example you've given you've deprecated only keyword arguments. So > I was wondering... > > would the following *untested* code work ? : > > def check_deprecated_args(deprecated): > def decorator(func): > def inner(*args, **kwargs): > for p in deprecated: > if p in kwargs: > print '%s is deprecated' % p > return func(*args, **kwargs) > return inner > return decorator > This is indeed a lot simpler than a class-based version, merci bien! And now I can also make it work with the signature-preserving decorator package. Meanwhile I also found a Python 2 backport for inspect.signature, so positional args can also be used. Thanks again! Albert-Jan
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: class-based class decorator Albert-Jan Roskam <fomcl@yahoo.com> - 2015-01-15 21:07 +0000
csiph-web