You should display in the error message what was passed (i.e. the repr of self.n_clusters). It helps debugging.