Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20456

Re: how to tell a method is classmethod or static method or instance method

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 <nathan.alexander.rice@gmail.com>
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 <mailman.5754.1329116374.27778.python-list@python.org> <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 <nathan.alexander.rice@gmail.com>
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 <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.5840.1329330708.27778.python-list@python.org> (permalink)
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

Show key headers only | View raw


> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

how to tell a method is classmethod or static method or instance method Zheng Li <dllizheng@gmail.com> - 2012-02-13 15:59 +0900
  Re: how to tell a method is classmethod or static method or instance method Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-13 08:03 +0000
    Re: how to tell a method is classmethod or static method or instance method 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-13 01:01 -0800
    Re: how to tell a method is classmethod or static method or instance method Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-15 13:31 -0500

csiph-web