次のようなクラス定義があります
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から考えてください。