Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8758
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
| Newsgroups | comp.lang.python |
| Subject | Re: Why won't this decorator work? |
| Date | Mon, 04 Jul 2011 20:22:37 +1200 |
| Lines | 21 |
| Message-ID | <97dbigF4d1U1@mid.individual.net> (permalink) |
| References | <8b8c3ca2-ae36-4009-842e-1dc90fb01b65@ct4g2000vbb.googlegroups.com> <mailman.561.1309628013.1164.python-list@python.org> <98cca0c2-8d4f-4313-abed-3f34fa165c6d@u28g2000yqf.googlegroups.com> <mailman.562.1309632366.1164.python-list@python.org> <a61a8a98-609a-4fb2-ba1a-45c9c1a374db@w4g2000yqm.googlegroups.com> <Xns9F17708D7849COKB@88.198.244.100> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net Ou9Ez0gfU9kHmbNPYreKuA9+aMUHITbezTEgjfL+1d/pP/NBfs |
| Cancel-Lock | sha1:h45JapkxAOSFILf4GFb+5uCaw30= |
| User-Agent | Mozilla Thunderbird 1.0.5 (Macintosh/20050711) |
| X-Accept-Language | en-us, en |
| In-Reply-To | <Xns9F17708D7849COKB@88.198.244.100> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:8758 |
Show key headers only | View raw
OKB (not okblacke) wrote: > A decorator basically modifies a function/method, so that ALL > subsequent calls to it will behave differently. Furthermore, usually a decorator is used when for some reason you *can't* achieve the same effect with code inside the function itself. For example, the classmethod() and staticmethod() decorators return descriptors that have different magical effects from a standard function object when looked up in a class or instance. Since that magic happens *before* the function is called, you can't do the same thing using an ordinary function. In this case, an ordinary function is quite sufficient, and there is no need to involve a decorator. -- Greg
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why won't this decorator work? John Salerno <johnjsal@gmail.com> - 2011-07-02 09:56 -0700
Re: Why won't this decorator work? MRAB <python@mrabarnett.plus.com> - 2011-07-02 18:33 +0100
Re: Why won't this decorator work? John Salerno <johnjsal@gmail.com> - 2011-07-02 11:08 -0700
Re: Why won't this decorator work? Tim Chase <python.list@tim.thechases.com> - 2011-07-02 13:45 -0500
Re: Why won't this decorator work? John Salerno <johnjsal@gmail.com> - 2011-07-02 13:39 -0700
Re: Why won't this decorator work? Ben Finney <ben+python@benfinney.id.au> - 2011-07-03 08:36 +1000
Re: Why won't this decorator work? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-07-03 18:01 +0000
Re: Why won't this decorator work? John Salerno <johnjsal@gmail.com> - 2011-07-03 20:24 -0700
Re: Why won't this decorator work? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-04 20:22 +1200
Re: Why won't this decorator work? Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-02 12:49 -0600
Re: Why won't this decorator work? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-03 16:14 +1200
Re: Why won't this decorator work? ChasBrown <cbrown@cbrownsystems.com> - 2011-07-02 12:16 -0700
Re: Why won't this decorator work? ChasBrown <cbrown@cbrownsystems.com> - 2011-07-02 12:17 -0700
Re: Why won't this decorator work? ChasBrown <cbrown@cbrownsystems.com> - 2011-07-02 12:16 -0700
Re: Why won't this decorator work? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-03 12:11 +1000
Re: Why won't this decorator work? John Salerno <johnjsal@gmail.com> - 2011-07-02 19:14 -0700
csiph-web