Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.066 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'instance,': 0.05; "(it's": 0.09; 'subject:method': 0.09; 'url:activestate': 0.09; 'alchemy': 0.16; 'subject:instance': 0.16; 'header:In-Reply-To:1': 0.22; 'url:code': 0.28; 'message-id:@mail.gmail.com': 0.29; 'pattern': 0.30; 'does': 0.32; 'to:addr:python-list': 0.35; 'something': 0.35; 'received:209.85.160': 0.36; 'class.': 0.37; 'passed': 0.37; 'received:google.com': 0.37; "i'll": 0.38; 'received:209.85': 0.38; 'received:209.85.160.46': 0.39; 'received:mail- pw0-f46.google.com': 0.39; 'subject:how': 0.39; 'received:209': 0.39; 'called': 0.40; 'to:addr:python.org': 0.40; 'property': 0.63; 'relating': 0.67; 'nathan': 0.84; 'subject:tell': 0.91 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 :content-type; bh=vDbKwVs4R4G39c4pAPhVrVA5v5yQUezL4F5vBcmZWZ4=; b=j6x2ipSgO3HEb0sLX07Flt0FztPW9nEOvNAsUH3y4B0dcBxqNsLlVZyGd2Ow3vv+pD 6tvvKWFz22qdMhYK4Kdh049UEjCgl2ayw7/jnUYsudnfstbQ/BriU+0X4JHYyhEYoHkX 4HeIoonHyzMLr8byXpMK12rJfxqMdifgt2CQg= MIME-Version: 1.0 In-Reply-To: <4f38c3cc$0$11112$c3e8da3@news.astraweb.com> References: <4f38c3cc$0$11112$c3e8da3@news.astraweb.com> Date: Wed, 15 Feb 2012 13:31:44 -0500 Subject: Re: how to tell a method is classmethod or static method or instance method From: Nathan Rice To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1329330708 news.xs4all.nl 6906 [2001:888:2000:d::a6]:57783 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20456 > And I'll take this opportunity to plug my dualmethod descriptor: > > http://code.activestate.com/recipes/577030-dualmethod-descriptor/ I use an analogous pattern in SQL Alchemy all the time (it's called hybridmethod/hybridproperty there). +1 to dualmethod, that pattern is great when you want a method or property that does something concrete when passed an instance, or something abstract relating to all instances when passed a class. Nathan