-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception raising in Field APIs #2846
Comments
Could you please give an example of changing an |
I refined the exception when converting from/to numpy array in the PR #3058. And there are many other asserts in the codebase. Welcome other contributions! You can have a look at the PR, as an example. I am unassigning myself since it is an umbrella issue. |
Thanks, gocegege! I have created a pull request. |
The current Field APIs, including ScalarField, MatrixField, and Structfield (after #2627) use assertions statements to check input validity, for example,
taichi/python/taichi/lang/matrix.py
Line 207 in 03e2923
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 infield.py
andmatrix.py
are supposed to raise errors.Contributions are greatly welcomed!
The text was updated successfully, but these errors were encountered: