Suppose I initialize a library, say, in python object -
#filename: file_A import file_ class A(): def __init__(self): self.pd = file_.pd self.np = file_.np
And suppose the content of the file_ is,
#filename: file_ import pandas as pd import numpy as np
You might be wondering what's the sense of including those libraries as objects, for
import file_ will anyway include namespace of
np but the reason of inclusion is to make these libraries available for child classes, as bellow.
#filename: file_B from file_A import A Class B(A): # Getting all the libraries without even importing them again.
My concern is about the implications of this strategy. Is it a better idea to adopt such way?