jszopi / repESP

Reproducing molecular ESP from partial charges and more
GNU General Public License v3.0
6 stars 7 forks source link

docs: Remove repetition between parameters and attributes in dataclass docstrings #27

Open jszopi opened 5 years ago

jszopi commented 5 years ago

In theory, dataclasses are dumb structs but with InitVar it is possible to process parameters before assigning to attributes or have attributes created in __post_init__.

In this library there's mostly basic coercing of a more general input type to the type in class internal storage. By itself, this could be documented at library level as a special case on the names (x_x) but types can still differ and that would have to be documented. Also, having a special case makes understanding complicated cases even more complicated.

For example, fields.Mesh.points is either simply converted from points_ InitVar in the case of NonGridMesh or created from other input arguments in the case of GridMesh.

I'm not sure what could be a good solution, for now I'll document the attributes referring the user to the docs for __init__. I don't think an established solution exists due to dataclasses being a new thing.