On 03/08/2016 21:12, Chris Angelico wrote:
On Thu, Aug 4, 2016 at 4:52 AM, BartC <b...@freeuk.com> wrote:
On 03/08/2016 14:31, Chris Angelico wrote:
On Wed, Aug 3, 2016 at 11:23 PM, BartC <b...@freeuk.com> wrote:
On 03/08/2016 09:58, Steven D'Aprano wrote:
But sometimes you try to find a .py import module and it doesn't seem to
exist anywhere. (sys.py for example).
Ultimately, you _cannot_ implement everything in Python, unless you
create some sort of crazy fudge like having function pointers with
real language support, in which case you're writing C code. Some
modules have to be implemented in the host language (C for CPython,
Java for Jython, etc), in order to provide lower-level functionality.
The approach I use is to provide direct access, from the language, to
external .dll or .so files.
Then it is possible, with a suitable interface *written in the byte-code
language*, to directly call C's fopen() for example.
Fairly common approach - and it means you'll never find those .py
files. So it's no different from looking for sys.py and not finding
it, except that in the case of CPython's sys, it's not even a DLL -
it's part of the interpreter core.
I don't understand. With direct access to msvcrt.dll, the interface to
that will be inside a .py file. Not buried away somewhere else.
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list