replace use of __dict__ with dir()/xdir()