NuMojo comes a wide range of functions, types, and constants. If you manually import everything, it will make the header of the file too long. On the other hand, using from numojo import * would import a lot of functions that you never use and would pollute the naming space.
This module tries to find out a balance by providing a list of things that can be imported at one time. The list contains the functions or types that are the most essential for a user.
You can use the following code to import them:
from numojo.prelude import *
fn main() raises:
var array = NDArray[i32](shape=List[Int](2, 3))
print(array)
In this case NDArray and dtypes are automatically imported.
This idea comes from the Rust.
NuMojo comes a wide range of functions, types, and constants. If you manually import everything, it will make the header of the file too long. On the other hand, using
from numojo import *
would import a lot of functions that you never use and would pollute the naming space.This module tries to find out a balance by providing a list of things that can be imported at one time. The list contains the functions or types that are the most essential for a user.
You can use the following code to import them:
In this case
NDArray
and dtypes are automatically imported.