Honestly it looks like most of your code can't be simplified. However I found:
to_positional_argument_string
is a mouth full, and people would understand your code easier if you just userepr
.to_keyword_argument_string
is another mouth full and so you could call itkw_repr
.- You may want to add a comment explaining what
isinstance(field, abc.Iterator)
is for. This is because at first it confused me. - [Controversial] You can change your code so that you don't need to be passed
constructor_or_initializer
. To do this you'd createparameters
when__repr__
is first used.