我正在使用谷歌教室 api,函数的参数之一需要回调。
def callback(request_id, response, exception):
if exception is not None:
print 'Error adding user "{0}" to the course course: {1}'.format(
request_id, exception)
else:
print 'User "{0}" added as a student to the course.'.format(
response.get('profile').get('name').get('fullName'))
在我的情况下,该方法在一个类中,并且我知道每个 python 方法都应该采用一个 self 对象,但是在这种情况下,这个函数将具有特定的参数,我不确定如何传递 self 对象或者我应该忽略 self 吗?问题是我计划在函数内部使用 self 。有任何想法吗?