Why not allow empty code blocks?

Chris Angelico rosuav at gmail.com
Wed Aug 3 16:12:17 EDT 2016


On Thu, Aug 4, 2016 at 4:52 AM, BartC <bc at freeuk.com> wrote:
> On 03/08/2016 14:31, Chris Angelico wrote:
>>
>> On Wed, Aug 3, 2016 at 11:23 PM, BartC <bc at 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.

ChrisA



More information about the Python-list mailing list