Python Modules, Aliasing, Randomness and Thor
Not a boring article about python
Clap if you find this helpful!
“What is a Module?”
Modules are used to divide chunks of code into their corresponding functional tribes and enable cross functional cooperation. This allows a code to be exponentially more efficient and easy to read. Using the process of decomposition, we can break down our frankensteinian source files and recreate them as elegant agile systems designed to enhance performance. This is much better than clumsy huge files.
A module is essentially a file that contains Python definitions and statements, which can be later imported and used when they are needed by the program or user.
math.sin() # produces the sine function from the module "math"
This example shows how we reference definitions from modules. The math definition of the sine function can be called in a simple line of code: “module_name.definition_name”.
Aliasing
Sometimes you may wish that you could rename a module something ridiculous like FrankSinatrasHat. Guess what! You can actually do that with a process called aliasing.
import numpy as FrankSinatrasHat