Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'subject:Python': 0.05; 'behave': 0.07; 'decorator': 0.09; 'descriptors': 0.09; 'url:peps': 0.09; 'python?': 0.15; 'metaclasses': 0.16; 'cc:addr :python-list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'cc:no real name:2**0': 0.20; 'cheers,': 0.20; 'dec': 0.22; 'header:In-Reply- To:1': 0.22; 'received:209.85.212.46': 0.23; 'received:mail- vw0-f46.google.com': 0.23; 'url:dev': 0.23; 'cc:2**0': 0.24; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'class': 0.29; 'decorators': 0.30; 'fewer': 0.30; 'rarely': 0.30; 'chris': 0.30; 'does': 0.32; 'wondering': 0.32; 'rather': 0.33; 'instead': 0.33; 'there': 0.33; 'probably': 0.34; 'received:209.85.212': 0.34; 'url:python': 0.36; 'received:google.com': 0.37; 'using': 0.38; 'received:209.85': 0.38; 'i.e.': 0.39; 'url:docs': 0.39; 'url:org': 0.39; 'received:209': 0.40; 'more': 0.61; '2011': 0.61; 'subject:!!!': 0.76; 'serious': 0.78; '11:18': 0.84; 'sender:addr:chris': 0.84; 'url:datamodel': 0.84; 'url:rebertia': 0.84; 'url:reference': 0.84; 'to:none': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:cc:content-type; bh=wpLOGD6Y3Nmsc9xpbF7+JYsYiDAJaFQgd53EvCpkTSM=; b=IjBBPQoVs3PcASFAJ7fE9eg9u2XMfqf/N9Y/6YOFlhZex8mSJN0FGQUIkHW9XjNFFi vg4ru1vwUn2lcj0PycVsDifqDZ1xdM1H5Ap1HAC4bxPr+ypUqtqtZX6rkIUqDdUaXoDh a8MHThH1bzCN1Jh8YmU0YRKx4uScY4knd3DOc= MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: <29996186.628.1323328726122.JavaMail.geo-discussion-forums@prfb7> References: <29996186.628.1323328726122.JavaMail.geo-discussion-forums@prfb7> Date: Thu, 8 Dec 2011 00:04:28 -0800 X-Google-Sender-Auth: FLYD0LRctj1tvNmtVvR1EHoyIC8 Subject: Re: I love the decorator in Python!!! From: Chris Rebert Cc: python-list@python.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323331470 news.xs4all.nl 6978 [2001:888:2000:d::a6]:46999 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16810 On Wed, Dec 7, 2011 at 11:18 PM, 88888 Dihedral wrote: > I use the @ decorator to behave exactly like a c macro that > does have fewer side effects. > > I am wondering is there other interesting methods to do the > jobs in Python? * Class decorators (http://www.python.org/dev/peps/pep-3129/ ); i.e. using decorators on a class instead of a function/method * Metaclasses (http://docs.python.org/dev/reference/datamodel.html#customizing-class-creation ); a rather more complicated feature capable of serious black magic * Descriptors (http://docs.python.org/dev/reference/datamodel.html#implementing-descriptors ); probably the most rarely directly used of the three Cheers, Chris -- http://rebertia.com