Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.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.091 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; 'overridden': 0.09; 'def': 0.10; 'inheritance': 0.16; 'oct': 0.16; 'wrote:': 0.17; 'certainly': 0.17; 'replacing': 0.17; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'skip:@ 10': 0.27; 'message- id:@mail.gmail.com': 0.27; 'correct': 0.28; 'though.': 0.29; 'class': 0.29; 'received:209.85.215.46': 0.30; 'could': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'think': 0.40; '30,': 0.62; 'furman': 0.84; 'pain': 0.84; 'to:name:python': 0.84; 'ethan': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=t87scJ2VP4WrLjXGprFzgRXFUbtaKh+99n6OH1WWMjg=; b=LXxcwnUanV7JwAbE48DUncOyjNHprXcY22hyqDmfQv+z95SzXPzSXmIIiirVS+TthJ iMngTcI4a48c7eyRYyvQ4OQqY00htKgyXxOvBKRW6KwXOeRZJXJaO5vGbdzGgesX4n1Q wCu6rTQe1IkrOGxN2MIHfk+iN2yzo62eZPVkO8RJBJ209CSIuJOyJVI6fUWbd8UINC3Q 2Rwgd7F3R+Tl0JJx1GwjJyjepX7NS6XTCIbvckCRLxCAn/WAD7sY4xTmHz9EVjasb4tf EbgS04wp34bpID3Cf4tzsJs2XMalcLekOoNz89PMKLsqgUNjZQ6m32iHJnBRHi8n7iNQ gQRA== MIME-Version: 1.0 In-Reply-To: <508FD8F1.7080102@stoneleaf.us> References: <508FD8F1.7080102@stoneleaf.us> From: Ian Kelly Date: Tue, 30 Oct 2012 09:27:20 -0600 Subject: Re: calling one staticmethod from another To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351610873 news.xs4all.nl 6907 [2001:888:2000:d::a6]:46146 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32497 On Tue, Oct 30, 2012 at 7:41 AM, Ethan Furman wrote: > class Spam(): > @staticmethod > def green(): > print('on a train!') > @staticmethod > def question(): > print('would you, could you', end='') > Spam.green() > > It can be a pain if you change the class name, but it is certainly one way > to do it. It fails if the staticmethod being called has been overridden in a subclass, though. I think the only correct way to do it with inheritance is by replacing it with a classmethod, as the OP suggested.