[refactor] Refactor func body to reduce python overhead and improve readability (#3984)
[refactor] Refactor func body to reduce python overhead and improve readability (#3984)

* Refactor func body to reduce python overhead and improve readability.

* Change function argument order and make is_ndarray an explicit flag.
yuanming-hu/taichi,yuanming-hu/taichi,yuanming-hu/taichi,yuanming-hu/taichi