I'm using an object's
my_environment.events.my_event -= self.event_handler_func
Exception AttributeError: "'NoneType' object has no attribute 'events'" in <bound method MyClass.__del__ of <myclass.MyClass instance at 0x04C54580>> ignored
According to the python doc about
[...] other globals referenced by the
__del__()method may already have been deleted or in the process of being torn down (e.g. the import machinery shutting down). For this reason,
__del__()methods should do the absolute minimum needed to maintain external invariants.
In other words, when the
__del__ method is called on your object, the
my_enviroment may have been 'deleted' by python, so it can be None...