[Python-Dev] More optimisation ideas

Sven R. Kunze srkunze at mail.de
Thu Feb 4 12:18:44 EST 2016


On 04.02.2016 14:09, Nick Coghlan wrote:
> On 2 February 2016 at 06:39, Andrew Barnert via Python-Dev
> <python-dev at python.org> wrote:
>> On Feb 1, 2016, at 09:59, mike.romberg at comcast.net wrote:
>>>   If the stdlib were to use implicit namespace packages
>>> ( https://www.python.org/dev/peps/pep-0420/ ) and the various
>>> loaders/importers as well, then python could do what I've done with an
>>> embedded python application for years.  Freeze the stdlib (or put it
>>> in a zipfile or whatever is fast).  Then arrange PYTHONPATH to first
>>> look on the filesystem and then look in the frozen/ziped storage.
>> This is a great solution for experienced developers, but I think it would be pretty bad for novices or transplants from other languages (maybe even including Python 2).
>>
>> There are already multiple duplicate questions every month on StackOverflow from people asking "how do I find the source to stdlib module X". The canonical answer starts off by explaining how to import the module and use its __file__, which everyone is able to handle. If we have to instead explain how to work out the .py name from the qualified module name, how to work out the stdlib path from sys.path, and then how to find the source from those two things, with the caveat that it may not be installed at all on some platforms, and how to make sure what they're asking about really is a stdlib module, and how to make sure they aren't shadowing it with a module elsewhere on sys.path, that's a lot more complicated. Especially when you consider that some people on Windows and Mac are writing Python scripts without ever learning how to use the terminal or find their Python packages via Explorer/Finder.
> For folks that *do* know how to use the terminal:
>
> $ python3 -m inspect --details inspect
> Target: inspect
> Origin: /usr/lib64/python3.4/inspect.py
> Cached: /usr/lib64/python3.4/__pycache__/inspect.cpython-34.pyc
> Loader: <_frozen_importlib.SourceFileLoader object at 0x7f0d8d23d9b0>
>
> (And if they just want to *read* the source code, then leaving out
> "--details" prints the full module source, and would work even if the
> standard library were in a zip archive)

I want to see and debug also core Python in PyCharm and this is not 
acceptable.

If you want to make it opt-in, fine. But opt-out is a no-go. I have a 
side-by-side comparison as we use Java and Python in production. It's 
the *ease of access* that makes Python great compared to Java.

@Andrew
Even for experienced developers it just sucks and there are more 
important things to do.


Best,
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160204/1009d7d4/attachment.html>


More information about the Python-Dev mailing list