>>> class test(object):
def simplewrap(self, func):
def wrapper(*args, **kwds):
self.print('----start----')
func(args, kwds)
self.print('----end----')
return wrapper
def print(self, string):
print('In function print')
print(string)
print('Finish')
@self.simplewrap
def wraped(self):
print('In function print')
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
class test(object):
File "<pyshell#24>", line 14, in test
@self.simplewrap
NameError: name 'self' is not defined
NameError: name 'self' is not defined
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
悬赏问题
- ¥20 ARM64架构下SSCMS部署问题
- ¥20 请教如何让移动端的热区自适应
- ¥30 为什么深度学习网络训练会出现训练集和测试集准确率和损失都不变的情况
- ¥15 (标签-3D|关键词-色模型)
- ¥15 发现在MSVS2022中”#pragma once“不起作用
- ¥15 实时声纹降噪算法进行无关说话人语音抑制
- ¥100 adb针对解决手机锁屏问题(相关搜索:手机锁屏)
- ¥15 发现哔哩哔哩的粉丝只能显示前5页能不能爬出来
- ¥15 oracle数据库求解
- ¥15 c++ websocketpp连接币安 有报错,有偿求解