Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; "(i'm": 0.09; 'def': 0.14; '16,': 0.15; 'cc:addr:python-list': 0.15; 'now).': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'java': 0.20; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.23; 'cc:2**0': 0.25; "i'm": 0.26; 'pass': 0.28; 'bound': 0.28; 'cc:addr:python.org': 0.29; 'message- id:@mail.gmail.com': 0.29; 'print': 0.29; 'class': 0.29; 'kelly': 0.30; 'shooting': 0.30; 'nov': 0.31; 'pm,': 0.31; 'thu,': 0.32; 'yet': 0.32; 'does': 0.32; 'pretty': 0.32; 'it.': 0.33; '17,': 0.34; 'matter,': 0.34; 'skip:@ 10': 0.34; 'received:74.125.82': 0.37; 'but': 0.37; 'received:google.com': 0.38; 'received:74.125': 0.39; 'define': 0.39; 'subject:: ': 0.39; 'far': 0.40; '2011': 0.62; 'url:co': 0.62 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=SgyCFUxmXrrT4jUMXeRAGs+DvCSTBGvxF1sgMFedrnI=; b=sioC63K0z5+7UCNmayTlpBfiM4yM/QCMX4Th4ThaJtgNdIBQWhTiBIOoAL/grS/uIN 5k+eGBcr3PWVgC/uYXoRW+eU3C+gO8zFrCIUdkxStDBa5r0S7S4fyScjIq3vpqkXAved Lt5ZRIbS7iuLKM9C+DN4m4C9tifeHfL1x0bSc= MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 17 Nov 2011 13:13:38 +0200 Subject: Re: staticmethod makes my brain hurt From: Dotan Cohen To: Ian Kelly 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1321528427 news.xs4all.nl 6928 [2001:888:2000:d::a6]:50550 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15816 On Thu, Nov 17, 2011 at 09:37, Ian Kelly wrote: > On Wed, Nov 16, 2011 at 11:44 PM, Dotan Cohen wrot= e: >> Try this (untested): >> >> class C: >> =C2=A0 @staticmethod >> =C2=A0 def foo(): >> =C2=A0 =C2=A0 =C2=A0 pass >> >> =C2=A0 print "inside", C.foo, callable(C.foo) > > If you had tested this, you would have found that you get a NameError, > since C is not yet bound inside the class block where you define it. > I hadn't tested, I'm at work far from Idle. Just shooting from the hip. For that matter, though, this does work in Java (I'm pretty sure but again, untested right now). --=20 Dotan Cohen http://gibberish.co.il http://what-is-what.com