Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17043
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <arnodel@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.027 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'beginners': 0.04; 'python': 0.08; 'descriptor': 0.09; 'protocol': 0.15; 'enlighten': 0.16; 'functools': 0.16; 'obj,': 0.16; 'pydoc': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'cc:no real name:2**0': 0.20; 'programming': 0.21; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.24; 'import': 0.27; 'message- id:@mail.gmail.com': 0.28; 'partial': 0.29; 'cc:addr:python.org': 0.29; "i've": 0.31; 'me?': 0.32; 'someone': 0.34; 'something': 0.35; 'url:python': 0.36; 'received:209.85.161': 0.36; 'but': 0.37; 'reference': 0.37; 'received:google.com': 0.37; 'skip:_ 10': 0.37; 'using': 0.38; 'received:209.85': 0.38; 'received:209': 0.40; '2011': 0.61; 'url:htm': 0.72; 'amaze': 0.84; 'fantastic,': 0.84; 'look.': 0.93; 'absolutely': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=mTC2aVuMatsWAbknK0f6NfiuCiBgSw/mNRJImiIC90Q=; b=XHx/6yApjzUU3jns5LL84kJImoSB6HfVITxpoT6YdkanZ4bsAkGSCV/D6Zyw6FgM8z sCbeC1I5ufS0muvAGv/1yjN6951qh3jAnLmIRKCsknZ4UUaConOTsImVzGpYjhbonNo6 m0+GFMZWtTDFAqUJwAbIXnciu9/W9Mt2aDH2k= |
| MIME-Version | 1.0 |
| In-Reply-To | <jc50ui$c84$1@speranza.aioe.org> |
| References | <jc4vg9$8eo$1@speranza.aioe.org> <mailman.3544.1323697523.27778.python-list@python.org> <jc50ui$c84$1@speranza.aioe.org> |
| Date | Mon, 12 Dec 2011 14:01:31 +0000 |
| Subject | Re: Confusion about decorators |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| To | Henrik Faber <hfaber@invalid.net> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3545.1323698494.27778.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1323698494 news.xs4all.nl 6982 [2001:888:2000:d::a6]:38440 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:17043 |
Show key headers only | View raw
On 12 December 2011 13:52, Henrik Faber <hfaber@invalid.net> wrote:
> On 12.12.2011 14:45, Arnaud Delobelle wrote:
>
>>> Can someone please enlighten me?
>>
>> You can (need to?) use the descriptor protocol to deal with methods.
>>
>> from functools import partial
> [...]
>> def __get__(self, obj, objtype):
>> return partial(self, obj)
>
> Whoa. This is absolutely fantastic, it now works as expected (I get a
> reference to "self").
>
> I am very amazed -- I've been programming Python for about 5 years now
> and have never even come close to something as a "descriptor protocol".
> Python never ceases to amaze me. Do you have any beginners guide how
> this works? The Pydoc ("Data Model") is comprehensive, but I really
> don't know where to start to look.
Well, I've been using Python for 10 years :) The best reference I know is:
http://users.rcn.com/python/download/Descriptor.htm
--
Arnaud
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Confusion about decorators Henrik Faber <hfaber@invalid.net> - 2011-12-12 14:27 +0100
Re: Confusion about decorators Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-12 13:37 +0000
Re: Confusion about decorators Henrik Faber <hfaber@invalid.net> - 2011-12-12 14:45 +0100
Re: Confusion about decorators Arnaud Delobelle <arnodel@gmail.com> - 2011-12-12 13:45 +0000
Re: Confusion about decorators Henrik Faber <hfaber@invalid.net> - 2011-12-12 14:52 +0100
Re: Confusion about decorators Arnaud Delobelle <arnodel@gmail.com> - 2011-12-12 14:01 +0000
Re: Confusion about decorators Henrik Faber <hfaber@invalid.net> - 2011-12-12 16:35 +0100
csiph-web