Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106244
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: [Python-ideas] Decorators for variables |
| Date | Fri, 1 Apr 2016 11:25:42 -0600 |
| Lines | 25 |
| Message-ID | <mailman.321.1459531585.28225.python-list@python.org> (permalink) |
| References | <CAEze2WgR7NdR9j01aAB9_hC_hx02nSu7fS2M8ain_P+JjRBcqw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de gM/IYeG6238UwhdwBN4AuQWiHMC+2nPHDPsFHH4+02VQ== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.03; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'syntax': 0.13; 'def': 0.13; '2016': 0.16; 'a(object):': 0.16; 'detects': 0.16; 'parent):': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reusable': 0.16; 'subject:ideas': 0.16; 'wrote:': 0.16; 'thanks.': 0.18; 'subject:] ': 0.19; 'prevent': 0.20; 'class,': 0.22; 'cycles': 0.22; 'decorator': 0.22; 'am,': 0.23; 'code.': 0.23; 'properties': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'example': 0.26; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; "i'm": 0.30; 'work.': 0.30; 'class.': 0.30; 'skip:_ 10': 0.32; 'class': 0.33; 'instances': 0.33; 'received:google.com': 0.35; 'could': 0.35; 'done': 0.35; 'but': 0.36; 'created': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'being': 0.37; 'received:209': 0.38; 'skip:p 20': 0.38; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'some': 0.40; "you'll": 0.61; 'here': 0.66; 'cycles.': 0.84; 'etc,': 0.84; 'to:name:python': 0.84; 'eliminates': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=4drthkU8RJFpMMOrojVWuOjueLztszNapRPMJ8D8Ej4=; b=lGPCiYVGWzksMdyOoNyAx7JYrzhcf9NaxO2mKzuYla+8cRJiH0E3uPkqJnou8olO7T JsgzAv53XV8djQ+8BafHLbugRuMdu6+zGeBy0t52vsUsg1m3UrN6sY8iI1BJTX6BwuQP yrSv2WIm23zJAb6RWQrT06cAWgDHonDnB5FO7Ja8wOWOcfvlCq3C9bUr0hpn5Rlhzkse qsjZrAi6aBhia9Kd9uVhA5olmo5EL1XFKnQ3llVpI5wyzn5Ins99AA2N2WSm6O9pFNHs krN7Fzj0ZW0mmxMK/0OhC0faJCLNtvirWpQUcxq3joqv832+UnraMmibiSmSVshb5k32 mQaA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=4drthkU8RJFpMMOrojVWuOjueLztszNapRPMJ8D8Ej4=; b=Clag3vXVsq4UaA7iH/NvHZde6p+vV0t8oE6xAp5ZWVUM9YjRgHwitFszXk7P4n+nOg EQoyCsA/1XLtI/Sg9BFDBc7OxVa/4pzSnM0Z/Oq9UywyBymZqMf9tZbQ7nX+qgOtTuIS L+mo7rVSTmjSvbkV5wJb72H8uFofm2g+DHVNiB/kqhbCn31A/cgYDZXcS/IfrPIWsBRj GtW33mFilUY3YgDg/5LCXtEhbfHpP8jk35agGzogGs8ot09F6i8dzM3bpW4kTuJBb+aB uPWu7dKnSdgMGLOH4YUlZCROUScvppPQdcc2NwGoBgilsns/Y5z2fyKnrYUS+JSlsB3Q Qvig== |
| X-Gm-Message-State | AD7BkJLKgKxSG6jpQkyX1xhUpbzwBb3e1RV0m6XYTX/4hKY8OIBkEOK3AvPttSkOFDgBGFWhMePSH3awOjbbEw== |
| X-Received | by 10.107.19.157 with SMTP id 29mr6835447iot.11.1459531582168; Fri, 01 Apr 2016 10:26:22 -0700 (PDT) |
| In-Reply-To | <CAEze2WgR7NdR9j01aAB9_hC_hx02nSu7fS2M8ain_P+JjRBcqw@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| 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> |
| Xref | csiph.com comp.lang.python:106244 |
Show key headers only | View raw
On Fri, Apr 1, 2016 at 11:14 AM, Matthias welp <boekewurm@gmail.com> wrote: >> An example of the transformation would help here > > An example, that detects cycles in a graph, and doesn't do an update if > the graph has cycles. Thanks. > class A(object): > def __init__(self, parent): > @prevent_cycles > self.parent = parent I think you'll find that this doesn't work. Properties are members of the class, not of instances of the class. > This would prevent cycles from being created in this object A, and would > make > some highly reusable code. The same can be done for @not_none, etc, to > prevent > some states which may be unwanted. But you could accomplish the same thing with "self.parent = prevent_cycles(parent)". So I'm still not seeing how the use of the decorator syntax eliminates repetition.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [Python-ideas] Decorators for variables Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-01 11:25 -0600
csiph-web