Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32497
| 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 | <ian.g.kelly@gmail.com> |
| 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 | <tit4m9-1ei.ln1@satorlaser.homedns.org> <508FD8F1.7080102@stoneleaf.us> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 30 Oct 2012 09:27:20 -0600 |
| Subject | Re: calling one staticmethod from another |
| To | Python <python-list@python.org> |
| 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 <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.3095.1351610873.27098.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
On Tue, Oct 30, 2012 at 7:41 AM, Ethan Furman <ethan@stoneleaf.us> 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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
calling one staticmethod from another Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-30 13:25 +0100
Re: calling one staticmethod from another Ethan Furman <ethan@stoneleaf.us> - 2012-10-30 06:41 -0700
Re: calling one staticmethod from another Dave Angel <d@davea.name> - 2012-10-30 09:47 -0400
Re: calling one staticmethod from another Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-30 16:39 +0100
Re: calling one staticmethod from another Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-30 09:27 -0600
Re: calling one staticmethod from another Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-30 21:29 +0000
csiph-web