我有一个类定义如下
class DashBoard(object):
def __init__(self):
self.ASC = 'asc'
self.DESC = 'desc'
self.DEFAULT_PAGE_SIZE = 10
def delete_dashboard(self, dashboard_name):
'''
function definition here
'''
def create_dashboard(self, members_and_scores):
'''
This will create the dashboard
'''
def update_dashboard(self, members_and_scores):
'''
This will update the dashboard
'''
现在在一个 django 视图中,我实例化了上面的类并更新了仪表板,一个最小的表示可以如下所示:
def some_django_view(request):
dashboard_instance = DashBoard()
member = mobj.shared_by
dashboard_instance.update_member_data(member, **options)
'''
rest stuff here
'''
现在我该如何处理dashboard_instance?
我需要专门删除实例吗?
请从内存泄漏/垃圾收集 POV 中思考。