blob: 649f6f29ed0c106e85d76f5bb158b7e9faa47f68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# chatty1.py
import sys,customdec,decorators
class chattymethod1(customdec.chattymethod):
def __init__(self,func):
super(chattymethod1,self).__init__(func)
self.logfile=self.logfile # class variable -> instance variable
class D:
chattymethod1.logfile=sys.stdout
def f(self): pass
f=chattymethod1(f)
chattymethod1.logfile=file('file.log','w')
def g(self): pass
g=chattymethod1(g)
d=D()
|