On Mon, Nov 23, 2020 at 11:56:47AM +1300, Greg Ewing wrote:
> On 22/11/20 4:31 pm, Christopher Barker wrote:
> >unfortunately, that's not how most python packages are set up -- you 
> >install the whole thing at once. As an example, it's really tricky to 
> >use even one function from scipy without installing the whole thing.
> 
> Something needs to change about how Python packages are set up,
> then. Most other software development systems manage to strip
> out unused stuff without needing a bunch of flakey heuristics
> for each individual library.

In a language without declarations, how do you know that something is 
unused?

One can, I guess, look for imports, but the presence of even a single 
eval or exec opens the flood-gates.

And then there could be code that looks at sys.modules directly. 
Possibly via an alias:

    # Module spam
    from sys import modules as bunchofstuff

    # Module eggs
    from spam import bunchofstuff
    re = bunchofstuff['re']

I trust you're not going to say that if you write obfuscated code like 
that, you deserve whatever pain you get :-)

-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/2DUJWXFYZW4VHW6KEYC4QDQ4KN6E2OAI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to