Re: Proposal: private keyword for import statements to hide module dependencies

bjotta via Python-list <[email protected]>
Newsgroups gmane.comp.python.general
Message-ID <[email protected]>
It seem like you are talking about classes and sub-classes. I was talking about dependencies in projects.


e..g I create a library that has some dependencies (numpy here)
Inside the library there is a file importing numpy for example.

'''
import numpy as np

def stock_earnings(winnings, losses):
    return winnings - losses
    
'''

I want to be able to restrict / name mangle the usage.
To avoid this being possible.

'''
from library.math import np.
'''

There are reasons for this, but for example at work we explicitly install all dependencies we use in our program.

If someone starts to use sub-dependency from a library without explicitly installing it. The next time the library updates and the maintainers decides to update to using numba or something else the code wont work.

That was the Idea behind the "private" keyword. Any other suggestion to that part?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.