Skip to main content
2 of 2
deleted 3693 characters in body
Peilonrayz
  • 43.5k
  • 7
  • 76
  • 155

Honestly it looks like most of your code can't be simplified. However I found:

  1. to_positional_argument_string is a mouth full, and people would understand your code easier if you just use repr.
  2. to_keyword_argument_string is another mouth full and so you could call it kw_repr.
  3. You may want to add a comment explaining what isinstance(field, abc.Iterator) is for. This is because at first it confused me.
  4. [Controversial] You can change your code so that you don't need to be passed constructor_or_initializer. To do this you'd create parameters when __repr__ is first used.
Peilonrayz
  • 43.5k
  • 7
  • 76
  • 155