change getattr and setattr to partial functions.