TeamGraphix / graphix

measurement-based quantum computing (MBQC) compiler and simulator
https://graphix.readthedocs.io
Apache License 2.0
64 stars 21 forks source link

Avoid `get_` / `set_` #220

Open EarlMilktea opened 1 month ago

EarlMilktea commented 1 month ago

Functions named get_ / set_ should be renamed due to following observations:

  1. If it is not getter/setter (ex. has extra arguments)

We should not use get_ / set_ as it is not a getter/setter.

  1. If it is lightweight getter/setter

We should consider @property for more user-friendly APIs.

  1. If it is costly getter, but can be cached

We should consider @functools.cached_property.

  1. If it is costly getter/setter that cannot be cached

We should avoid get_ / set_ as attribute getter/setter are considered to be lightweight.