Consider following code:
if value and self.fps_display is None:
self.fps_display = clock.ClockDisplay()
elif not value and self.fps_display is not None:
self.fps_display.unschedule()
# Do this
del self.fps_display
# or this
self.fps_display = None
# or leave both in ?
Which is better python cleanup ?
There is no difference for garbage collection — in both cases a reference to object pointed to by
self.fps_displaywill be released. Which one you should use depends on whether you want the name to still exist (albeit now pointing to a different object,None), or not.