I find this line you mentioned quite confusing, for a few reasons. First, getting the basename of a string literal "__file__" is not doing what you probably expect. It was probably meant to be used without the quotes, as the magic variable for the current file name.
Why was this particular approach used with the goal of finding out if the object is an instance of the current class? Do these other options not work?- isinstance()
- obj.__class__ is self.__class__
- hasattr() duck typing
Relying on the string representation comparison seems like it would easily fail.
Justin