Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72890 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2014-06-07 10:20 +1000 |
| Last post | 2014-06-07 10:20 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Decorating one method of a class C with another method of class C? Chris Angelico <rosuav@gmail.com> - 2014-06-07 10:20 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-06-07 10:20 +1000 |
| Subject | Re: Decorating one method of a class C with another method of class C? |
| Message-ID | <mailman.10837.1402100435.18130.python-list@python.org> |
On Sat, Jun 7, 2014 at 10:14 AM, Dan Stromberg <drsalists@gmail.com> wrote: > 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. Since decoration happens at class creation, and arguments like self are available only when the method's actually called, no, there's no way you can define the method with something using information that doesn't exist yet and may change from one call to the next :) What are you trying to do, exactly? ChrisA
Back to top | Article view | comp.lang.python
csiph-web