Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!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.062 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'subject:method': 0.09; 'subject:class': 0.16; 'later': 0.20; 'seems': 0.21; 'specify': 0.24; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'apparently': 0.31; 'class': 0.32; 'subject:with': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:one': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=XQ+QqK/N2BbrtQh6X/vZi500k5b8hcZBa/07TgDDYFI=; b=E6elBrTyO9i9XW2CuvDqXG3VWRk13lPi6C5TwRWTxAwg5TOdWZeQpKBIOaMFlw70K5 uOkseWh+81xvcgpKcnUkrn4F+17SCDN1HsRs94G5VKgPsA7CY9cxWKcCGShHIw+jvk/Q 9dn9JjPfBpJb0hHDGew3gkRVy9vlW92k7iV8ckNcsV91v7IUeTKimrbwv0jbbWBGbe2Q 6ri1ucKqcWW2kS8+MiSJW6mCayFy3PAFHCYzE952Tea7SmbUEzRl6sgcffmTXx0QKcgj 6v0V9LxVPzyfYUgUFE2GyGCwXr4Z7SgpZbGwXS7Mr5UWkOGevTq/I+vGhli/t6HXs5pw f8Yg== MIME-Version: 1.0 X-Received: by 10.224.23.138 with SMTP id r10mr13554746qab.101.1402100095115; Fri, 06 Jun 2014 17:14:55 -0700 (PDT) Date: Fri, 6 Jun 2014 17:14:54 -0700 Subject: Decorating one method of a class C with another method of class C? From: Dan Stromberg To: python-list@python.org Content-Type: text/plain; charset=UTF-8 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: 5 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402100103 news.xs4all.nl 2960 [2001:888:2000:d::a6]:53518 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72889 Is there a way of decorating method1 of class C using method2 of class C? It seems like there's a chicken-and-the-egg problem; the class doesn't seem to know what "self" is until later in execution so there's apparently no way to specify @self.method2 when def'ing method1.