taichi-dev/taichi

Exception raising in Field APIs

Open

#2.846 geöffnet am 30. Aug. 2021

Auf GitHub ansehen
 (3 Kommentare) (4 Reaktionen) (1 zugewiesene Person)C++ (2.384 Forks)batch import
feature requestgood first issuewelcome contribution

Repository-Metriken

Stars
 (28.195 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

The current Field APIs, including ScalarField, MatrixField, and Structfield (after #2627) use assertions statements to check input validity, for example,

https://github.com/taichi-dev/taichi/blob/03e2923d103704048c101051d337fa31f9dbb1de/python/taichi/lang/matrix.py#L207

In software engineering practice, assertion is used to verify whether the program itself is implemented correctly regardless of user inputs, while exceptions/errors are used to check validity of the inputs. Therefore quite a few occurrences of assert statements in field.py and matrix.py are supposed to raise errors.

Contributions are greatly welcomed!

Contributor Guide